SQL基本語句增刪改查


1.select 

從表中獲取數據:

 

1 select * from table  # 獲取表table中的所有數據
2 select (id,name) from tabel #獲取指定字段
3 select * from table where name='zhang' #獲取指定條件的

 

2. insert

 

1 insert into table values ('1','2',...) #按表中字段順序插入
2 insert into table (name,address,..) values (...) #按所給的字段名插入

 

3.update

 

 

1 update 表名 set 列名 = 新值 where 列名 = 要修改的值
2 例如:3 update table set name='li' where id=1   注:update語句中的where很重要,如果沒有則默認更新所有的

4.delete

delete from table where id=1 注:delete語句中的where非常重要,一般是必須寫的,如果沒有則刪除表中的所有數據

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM