美文网首页
SQLite(语法)

SQLite(语法)

作者: 不合格码农 | 来源:发表于2019-02-21 16:31 被阅读1次

    参考:http://www.runoob.com/sql/sql-syntax.html

    1.大小写敏感

            SQLite 是不区分大小写的,但也有一些命令是大小写敏感的,比如 GLOB 和 glob 在 SQLite 的语句中有不同的含义。

    2.SQLite语句

              所有的 SQLite 语句可以以任何关键字开始,如 SELECT、INSERT、UPDATE、DELETE、ALTER、DROP 等,所有的语句以分号(;)结束。

    3.SQLite ANALYZE 语句:

            

    4.SQLite AND/OR 子句:

            

    5.SQLite ALTER TABLE 语句:

        ALTER ABLE table_name RENAME TO new_table_name;

    6.SQLite ALTER TABLE 语句(Rename):

        ALTER TABLE table_naem RENAME TO new_table_name;

    7.SQLite ATTACH DATABASE 语句:

        ATTACH DATABASE 'DatabaseName' As 'Alias-Name';

    8.SQLite BEGIN TRANSACTION 语句

        BEGIN:

        or

        BEGIN EXCLUSIVE TRANSACTION;

     9.SQLite BETWEEN     子句:

        SELECT column1,column2,...columnN

        FROM table_name

        WHERE column_name BETWEEN val-1 AND val-2;

    10.SQLite COMMIT 语句

        COMMIT;

    11.SQLite CREATE INDEX 语句:

        CREATE INDEX index_name

        ONtable_name( column_name COLLATE NOCASE );

    12.SQLite CREATE UNIQUE INDEX     语句

        CREATE UNIQUE INDEX index_name    

        ON table_name ( column1,column2,....columnN);

    13.SQLite CREATE TABLE 语句:

        CREATE TABLE table_name

            ( column1 datatype,

               column2 datatype,

                 column3 datatype, 

                 ..... 

                 columnN datatype,   

                 PRIMARY KEY( one or more columns )

               );

    14.SQLite CREATE TRIGGER 语句:

            CREATE TRIGGER database_name.trigger_name

            BEFORE INSERT ON table_name FOR EACH ROWBEGIN

              stmt1;

              stmt2; 

             ....

            END;

    15.SQLite CREATE VIEW 语句:

            CREATE VIEW database_name.view_name AS

            SELECT statement....;

    16.SQLite CREATE VIRTUAL TABLE 语句:

            CREATE VIRTUAL TABLE database_name.table_name USING weblog( access.log );

            orCREATE VIRTUAL TABLE database_name.table_name USING fts3( );

    17.SQLite COMMIT TRANSACTION 语句:

            COMMIT;

    18.SQLite COUNT 子句:

        SELECT COUNT(column_name)

        FROM table_name

        WHERE  CONDITION;

    19.SQLite DELETE 语句:

        DELETE FROM table_name

        WHERE  {CONDITION};

    20.SQLite DETACH DATABASE 语句:

        DETACH DATABASE 'Alias-Name';

    21.SQLite DISTINCT 子句:    

        SELECT DISTINCT column1, column2....columnN

        FROM  table_name;

    相关文章

      网友评论

          本文标题:SQLite(语法)

          本文链接:https://www.haomeiwen.com/subject/mlqmdqtx.html