資料庫相關

2022-09-01 05:15:08 字數 938 閱讀 2129

[db lasterrormessage]

sqlite3 zpp.db 建立叫zzp的資料庫

create table if not exists zzp1 (id integer primary key autoincrement, age integer,name varchar(128), stuno integer default 0);

建立乙個叫 zzp1 的表 表裡包含自動增加的主鍵

id (primary key à 主鍵) 自動增加(autoincrement à 自動增量)

name 字元型 (varchar)最大位元組是128

stuno integer 預設是0

。tables;

drop table zzp   在資料庫裡刪除叫zzp 的表

查詢語句  select id, age, name, money, from zzp where name like '%忠%';   '%忠%' à 表示name 這個引數中 中間是 「忠」 的字串 。%的位置可以改變來查詢不同位置

insert into zzp (id,name,age) values(1000,'大牛之路',9999);

select * from zzp;

select name from zzp where age = 10005;

update zzp set name = '火影忍者' where id = 2;

update zzp set name = '小虎還鄉',id = '1001' where age = 35;

update zzp set name = '忠鵬加油';

update zzp set age = age + 10 where id = 2;

delete from zhongpeng where id = 2;

delete from zhongpeng;

資料庫相關

1.操作類 godb public goosundb open throws sqlexception public void close public cursor search int mark mark mark,null,null,null,col date desc if cursor n...

資料庫相關

資料庫的設計 分庫分表,記憶體資料庫,主從讀寫分離,資料庫中介軟體mycat 整合了主從讀寫分離,分庫分表等功能 資料庫優化 sql語句優化,資料庫配置優化,索引優化,資料庫設計優化 資料庫的鎖 1.樂觀鎖,表中增加版本字段,每次更改加1,查的時候先把版本字段查出來,更新的時候加上條件版本欄位沒變,...

資料庫相關

1 多顯示乙個字段,格式 使用者名稱 手機號 select concat name,tel from user 2 手機號顯示 132 22 select concat left tel,3 right tel,2 as 安全手機號 from user 1 多顯示乙個字段,格式 使用者名稱 手機號 ...