SQLite資料庫基本知識(二)

2021-09-14 05:54:46 字數 982 閱讀 5427

一、插入語句

employee表中原有格式:id integer,

name text,

*** integer,

salary real,

entry_date text,

resume text

insert into employee values (1,『小明』,0,5000.1,『2019-01-01』,『技術員』);

//這種是按照表中的格式逐一填入

insert into employee (id,name,***,resume) value (2,『小紅』,1,『測試員』);

//這種是直插入想填入的資料,其他資料則不用填寫,預設為空

二、查詢語句

select * from employee;

三、修改語句

1.將上表所有員工的薪水改為6000元

update employee set salary=6000;

2.修改指定人的薪水為5000

update employee set salary=3000 where name=『小紅』;

3.將姓名為『李明』的員工薪水修改為4000元,***改為女性

update employee set salary=4000,***=『1』 where name=『李明』;

4.將小紅的薪水在原有的基礎上增加1000元

update employee set salary=salary+1000 where name=『小紅』;

四、刪除語句

1.刪除姓名為小明的行

delete from employee where name=『小明』;

2.刪除表中所有資料

delete from employee;

//delete語句不能刪除某一列的值,但是可以使用update 將該列值置為空

//使用delete語句僅刪除記錄,不刪除表本身。如要刪除表,使用drop table語句

SQLite資料庫基本知識(一)

一 sqlite的儲存型別 sqlite將資料值的儲存化為以下幾種儲存型別 null 表示該值為null值。integer 整型值 real 浮點值 text 文字字串資料 blob 儲存二進位制資料 對於布林資料型別 sqlite並沒有提供專門的布林儲存型別,取而代之的是儲存整形1表示true,0...

資料庫基本知識二

sql與高階語言 jdbc drivermanager create connection connection create statement statement create resultset connection connect driverprogram statement do som...

NOSQL資料庫基本知識 二

以乙個電商客戶 訂單 訂購 位址模型來對比下關係型資料庫和非關係型資料庫傳統的關係型資料庫設計,er圖 1 1 1 n n n,主外來鍵等常見 nosql設計 可以用bson,bson 是一種類json的一種二進位制形式的儲存格式,簡稱binary json,它和json一樣,支援內嵌的文件物件和陣...