📄 tutorial
字号:
Copyright (GPL) 2004, Mike Chirico mchirico@users.sourceforge.net or mchirico@comcast.net Compile ./configure --enable-threadsafeATTACH DATABASE Examples of using attach database: First, create two database and add a few tables $ sqlite3 test1.db sqlite> create table emp (pkey integer primary key, fn varchar(30), ln varchar(50), age int, addr1 varchar(50), addr3 varchar(50)); Next, run the tables command just to make sure everything is there. In addition, the .schema command will list the create statement. sqlite> .tables sqlite> .schema To quite the database .q sqlite> .q Note this time test2.db is loaded; but, since it's got a period '.' in the name the attach statement must have the name in quotes: "test1.db" as follows: $ sqlite3 test2.db sqlite> attach "test1.db" as t1; sqlite> insert into t1.emp (ln,age,addr1) values ('Chirico',41,'123 Forklanding Rd'); sqlite> create table exams (pkey integer primary key, empkey int, exam int, score int); sqlite> insert into exams (empkey,exam,score) values (1,1,78); sqlite> select * from exams e, t1.emp where e.empkey=t1.emp.pkey;How to auto-insert date and time: CREATE TABLE testdate ( id NUMBER NOT NULL, timeEnter DATE); CREATE TRIGGER insert_date AFTER INSERT ON testdate BEGIN UPDATE testdate SET timeEnter = DATETIME('NOW') WHERE rowid = new.rowid; END;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -