【正文】
cribe tbl。 MYSQL數(shù)據(jù)庫基礎(chǔ) ? 使用數(shù)據(jù)庫 插入數(shù)據(jù) insert into tbl(字段集 ) values(值集 ) 例: insert into tbl(username,password,lastlogin) values(‘a(chǎn)hut’,’123456’,now()) 調(diào)用一個(gè)寫好的 sql語句 source d:\。 查詢數(shù)據(jù) select 字段 from tbl where 條件 [limit start,rows] MYSQL數(shù)據(jù)庫基礎(chǔ) 例: select * from tbl limit 0,3 (1)基本查詢 select *[字段 ] from tbl (2)條件查詢 select * from tbl where 字段 條件 值 select * from tbl where username like ‘a(chǎn)%’ select * from tbl where (age20 and scrore80) or age20 MYSQL數(shù)據(jù)庫基礎(chǔ) (3) 多表查詢 select * from tbl1,tbl2 多表查詢滿足迪卡爾積 (4) 排序查詢 select * from tbl order by id desc[asc] //按大小排序 select * from tbl group by password //按類排序 select count(*) as t group by password //按類統(tǒng)計(jì) select * from tbl group by password having username=‘a(chǎn)hut’ //根據(jù)條件按類統(tǒng)計(jì) MYSQL數(shù)據(jù)庫基礎(chǔ) (5) 查詢非字段 select 6*5。 //查詢計(jì)算結(jié)果 select now()。 //查詢系統(tǒng)時(shí)間 ? 更新內(nèi)容 命令: update tbl set 字段 =值 where 條件 ? 刪除記錄 delete from tbl where 條件 truncate tbl //刪除表中所有記錄