sqlite的sql常用語句(筆記)

2022-01-15 09:10:24 字數 1530 閱讀 1134

1.複製一張表並重命名

比如已經建立好乙個表 表名為「28165「

複製這個表。

2.根據列,行的欄位名,查詢唯一欄位的值。

比如我的資料庫裡面有一張表「28165」.凡是欄位和表名以數字開頭的,在sql語句中都要把這個欄位以方括號括起來,要不然無法執行查詢操作。

我要查詢到圖中紅框的資料「100」。需要的查詢指令如下:

出來的結果是個一位陣列。要取出來的話,arry[0] ,再轉為sting即可使用。

指令碼的模式快速建立**:

資料庫取值模板:

select efo_current_upperlimit from efo where capillary =28165 

select id from [28135] where kind="bf"

數字開頭的表,要加括號 ,字段裡面是字元的要加雙引號 "" ,

例如,查詢28165劈刀bf 2ndupperlimit。

select [2ndupperlimit] from [28165] where kind="bf"

updata 資料庫的最後一條記錄:

update logs set ifalarm='yes' where id=(select id from logs order by id desc limit 1)

SQLite常用語句

型別 描述null 值是乙個空值 integer 帶符號的整數,根據值得大小儲存在1 2 3 4 6或8位元組中。相容 等同於 其他資料庫的int,integer,tinyint,smallint,mediumint,bigint,unsigned big int,int2,in8 real 浮點值...

sqlite常用語句

select from yanyou copy1 order by cast ctime as int limit 0,10 select from yanyou copy1 order by cast ctime as int desc limit 0,10 select count from y...

sqlite常用語句

sqlite3.exe 資料庫名字.db create table 表名 表名 字段型別,表名 字段型別,databases tables schema 表名 header on.mode column select from 表名 delete from 表名 where 條件 insert in...