Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQLITEÈëÃÅ Öð²½½²½âSQLITEÃüÁîÐÐ(ËÄ)

.dump ?TABLE? ... ÒÔSQLÓï¾ä·½Ê½ÏÔʾ±íµÄ½á¹¹¡£È磺
sqlite> .dump websties
BEGIN TRANSACTION;
COMMIT;
sqlite> .dump websites
BEGIN TRANSACTION;
CREATE TABLE [websites] (
[WebID] INTEGER NOT NULL PRIMARY KEY,
[WebName] VARCHAR(20) NULL
);
INSERT INTO "websites" VALUES(1,'CTOChina.net');
INSERT INTO "websites" VALUES(2,'ËѺü');
INSERT INTO "websites" VALUES(3,'ÑÅ»¢');
COMMIT;
sqlite>
.echo ON|OFF ÊÇÊä³ö»¹ÊÇÒþ²Ø²Ù×÷ÃüÁîµÄÃüÁĬÈÏÊÇÒþ²Ø£¬ ÏÔʾÃüÁ
sqlite> .echo on
sqlite> select * from websites;
select * from websites;
1|CTOChina.net
2|ËѺü
3|ÑÅ»¢
sqlite>
¿ÉÒÔ¿´³ö"select * from websites;"ÔںͲéѯ½á¹ûÒ»ÆðÏÔʾÔÚÆÁÄ»ÉÏ¡£
Òþ²ØÃüÁîÈ磺
sqlite> .echo off
sqlite> select * from websites;
1|CTOChina.net
2|ËѺü
3|ÑÅ»¢
sqlite>
.exit Í˳öSQLite³ÌÐò
.explain ON|OFF
".explain"ÃüÁî¿ÉÒÔ±»ÓÃÀ´ÉèÖÃÊä³ö¸ñʽΪ“column” ²¢ÉèÖÃÁпíΪEXPLAINÃüÁî¿´ÆðÀ´±È½ÏºÏÀíµÄ¿í¶È¡£EXPLAINÃüÁîÊÇSQLiteÌØÓеÄSQLÀ©Õ¹£¬ËüÊǶԵ÷ÊÔÓÐÓá£Èç¹ûÈκγ£¹æµÄSQL±»EXPLAINÖ´ÐУ¬ÄÇôSQLÃüÁî±»·Ö½â²¢·ÖÎöµ«²¢²»Ö´ÐС£È¡¶ø´úÖ®µÄÊÇ£¬ÐéÄâ»úÖ¸ÁîÐòÁн«±»ÓÃÓÚÖ´ÐÐSQLÃüÁî²¢·µ»ØÒ»¸öÀàËƵIJéѯ½á¹û¡£¿É½áºÏ.widthÃüÁî²é¿´Ð§¹ûÈ磺
sqlite> .explain
sqlite> select * from websites;
WebI WebName
---- -------------
1 CTOChina.net
2 ËѺü
3 ÑÅ»¢
sqlite>
ÓÃ.widthÉèÖÿí¶ÈÔÙ¿´Ð§¹û
sqlite> .width 10 20
sqlite> select * from websites;
WebID WebName
---------- --------------------
1 CTOChina.net
2 ËѺü
3 ÑÅ»¢
sqlite>
.header(s) ON|OFF Êä³ö|Òþ²Ø×Ö¶ÎÃûÑ¡ÏĬÈÏÊÇÒþ²Ø£¬È磺
sqlite> select * from websites;
1|CTOChina.net
2|ËѺü
3|ÑÅ»¢
sqlite>
ÎÒÃÇÓÃ.headerÃüÁî°Ñ×Ö¶ÎÃûÏÔʾ³öÀ´£¬È磺
sqlite> .header on
sqlite> select * from websites;
WebID|WebName
1|CTOChina.net
2|ËѺü
3|ÑÅ»¢
sqlite>
ת×Ô£ºhttp://www.ctochina.net/topic/ShowCArticle/349.html


Ïà¹ØÎĵµ£º

ÔÚsqliteÊý¾Ý¿âÖУ¬intÀàÐͲ»µÈÓÚintegerÊý¾ÝÀàÐÍ

ÕâЩÌìÒ»Ö±ÔÚæÏúÊÛ¹ÜÀíÈí¼þÒ×Âôͨ¿Í»§¶ËµÄ³ÌÐò±àд£¬ÓÉÓÚÐèÒª²ÉÓñ¾µØÊý¾Ý»º´æ»úÖÆÀ´Ìá¸ß³ÌÐòµÄÊý¾Ý·ÃÎÊЧÂÊ£¬ËùÒÔÐèÒªÔÚ¿Í»§¶ËʹÓÃÒ»¸öСÇɵı¾µØÊý¾Ý¿â¡£Õâ¸öÊý¾Ý¿âµ±È»ÒªÐ¡¶ø¾«º·µÄ¡£ÎÒÒ²²»Ïë×öÇ¿µÁ£¬ÓÚÊǾÍÑ¡ÔñSqlite°É——ÎļþÊý¾Ý¿â£¬Ö»ÒªÒ»¸öSqlite.dll¾Í¿ÉÒÔ²Ù×÷Êý¾Ý¿â¡£
²»µÃ²»³ÃÈ˱¾ÈËÊÇÓеã͵ÀÁ£¬Ad ......

ÔÚ.NET C#ÖÐʹÓÃsqlite

 1¡£´Ówww.sqlite.orgÏÂÔØSQLite 3.3.4µÄ°æ±¾
ΪÁË·½±ã£¬ÎÒ°ÑËü½âѹÁË£¬¾ÍÒ»¸öSQLite3.exe£¬·ÅÈëWindowsĿ¼Ï¡£
Cmd ½øÈëÃüÁîÐÐ
1)
´´½¨Êý¾Ý¿âÎļþ:
>SQLite3 d:\test.db »Ø³µ
¾ÍÉú³ÉÁËÒ»¸ötest.dbÔÚdÅÌ¡£
ÕâÑùͬʱҲSQLite3¹ÒÉÏÁËÕâ¸ötest.db
2)
ÓÃ.help¿ÉÒÔ¿´¿´ÓÐʲôÃüÁî
>.help »Ø³µ¼´¿É
3)¿ÉÒ ......

SqliteʵÏÖĬÈÏʱ¼äΪµ±Ç°Ê±¼äÁеķ½·¨

    ÔÚSQL ServerÖУ¬´´½¨±í¸ñµÄʱºò£¬¶ÔÓÚʱ¼äÁÐÓÐʱºòÎÒÃÇ¿ÉÒÔ¸ù¾ÝÐèÒªÖ¸¶¨Ä¬ÈÏֵΪµ±Ç°Ê±¼ä£¨Ò²¾ÍÊÇ˵¼Ç¼Éú³ÉµÄʱºòÓÐĬÈϵÄʱ¼ä´Á£©¡£ÀýÈ磺
    create table log(
content varchar(256),
logtime datetime default getdate()
)
  
    È» ......

Sqlite DBʹÓÃÀý×Ó

Ç°Ò»Õó×Ö×öÏîÄ¿(ǶÈëʽlinux)£¬ÓÉÓÚÒª±£´æ´óÁ¿µÄÊý¾Ý£¬¶øÇÒ×Ҫ±£´æ30ÌìµÄʱ¼ä¡£±¾À´´òËã±£´æµ½ÎļþÖУ¬Ã¿´ÎÆô¶¯Ó¦ÓóÌÐòµÄʱºòÖØнâÎöÒ»±é£¬¿ÉÊǵ±Êý¾ÝÁ¿ºÜ´óµÄʱºò£¬¾Í³öÏÖЧÂʵÄÎÊÌâÁË¡£ËùÒÔ×îºó»¹ÊÇ·ÅÆúÁËʹÓÃÎļþµÄ´òË㣬¾ö¶¨Ê¹ÓÃÊý¾Ý¿â´æÈ¡Êý¾Ý¡£
linuxϵÄÊý¾Ý¿âÒ²ºÜ¶à£¬ÓпªÔ´µÄ£¬Ò²ÓÐÊշѵġ£¶ÔÓÚÎÒÃÇÀ´Ëµ£¬¿Ï ......

Sqlite DateTime ÀàÐÍ ¶ÁÈ¡ºÍдÈë¸ñʽעÒâµÄÎÊÌâ

±¾ÎÄתÔØ×Ô http://www.tntserver.cn/article.asp?id=41
½ñÌìÓöµ½¸öÎÊÌâ.
Ê×ÏȲåÈëÒ»¸öDataTime¸ñʽµÄÊý¾Ý:
string sql="insert into [table] (date_time) values('" + date_time.ToString() + "'";
Ö´ÐÐÈçÉÏÃüÁî.²åÈëûÓб¨¸æ´íÎó.
µ«ÊÇ,ÎÒÓÖÓÃÒ»ÌõÃüÁî¶Áȡʱ:
string sql="select * from [table];
.....
IDataRea ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ