增加數(shù)據(jù):insert into 表名 values(要插入的數(shù)據(jù)中間用逗號(hào)隔開,同時(shí)插入數(shù)據(jù)要按照創(chuàng)建表的順序插入);
修改:update? 表名? set? 列名='修改成的值';——修改某一列所有的數(shù)據(jù)
? ? ? ? ? ? update? 表名? set 列名='修改成的值'? ?where 所跟的條件(例如id=1)——帶條件的修改(如果要修改多個(gè)值的話,在set后用逗號(hào)隔開)
刪除數(shù)據(jù):delete from? 表名;——?jiǎng)h除表中所有的數(shù)據(jù)
? ? ? ? ? ? ? ? ? delete from表名? where 條件——帶條件的刪除
? ? ? ? ? ? ? ? ? 另一種方式:
? ? ? ? ? ? ? ? ??truncate table? 表名;——?jiǎng)h除整張表的數(shù)據(jù)
delete from與truncate table的區(qū)別:
1)都可以刪除整張表的數(shù)據(jù);但是delete可以帶條件,而truncate 不能帶條件
2)delete from只能刪除表的數(shù)據(jù),但不能刪除表的約束,而truncate既可以刪除數(shù)據(jù),又可以刪除約束。
3)delete from刪除的數(shù)據(jù)可以回滾(事務(wù)),而truncate table刪除的數(shù)據(jù)不可以回滾
查詢數(shù)據(jù):select * from? 表名;——查詢所有列