SQL语句分类
SQL語句被分為五大類:
-
數據定義語言DDL
-
數據查詢語言DQL
-
數據操縱語言DML
-
數據控制功能DCL
-
事務控制語言TCL
DDL(Data Definition Language,數據定義語言) (create,drop,alter)
DQL(Data Query Langauge,數據查詢語言)(select)
DML(Data Manipulation Langauge,數據操縱/管理語言) (insert,delete,update)
DCL(Data Control Language,數據控制語言) grant(授權),revoke(撤銷權限)
TCL(Transaction Control Language,事務控制語言) commit(提交事務),rollback(回滾事務)
幾個簡單的基本的sql語句
選擇:select * from table1 where 范圍
插入:insert into table1(field1,field2) values(value1,value2)
刪除:delete from table1 where 范圍
更新:update table1 set field1=value1 where 范圍
查找:select * from table1 where field1 like ’%value1%’?
排序:select * from table1 order by field1,field2 [desc]
總數:select count as totalcount from table1
求和:select sum(field1) as sumvalue from table1
平均:select avg(field1) as avgvalue from table1
最大:select max(field1) as maxvalue from table1
最小:select min(field1) as minvalue from table1
?
總結
- 上一篇: 联想记忆计算机网络,什么是双向联想记忆神
- 下一篇: Python3 使用 pymysql 连