SQL语句分类
SQL語句被分為五大類:
-
數(shù)據(jù)定義語言DDL
-
數(shù)據(jù)查詢語言DQL
-
數(shù)據(jù)操縱語言DML
-
數(shù)據(jù)控制功能DCL
-
事務(wù)控制語言TCL
DDL(Data Definition Language,數(shù)據(jù)定義語言) (create,drop,alter)
DQL(Data Query Langauge,數(shù)據(jù)查詢語言)(select)
DML(Data Manipulation Langauge,數(shù)據(jù)操縱/管理語言) (insert,delete,update)
DCL(Data Control Language,數(shù)據(jù)控制語言) grant(授權(quán)),revoke(撤銷權(quán)限)
TCL(Transaction Control Language,事務(wù)控制語言) commit(提交事務(wù)),rollback(回滾事務(wù))
幾個簡單的基本的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]
總數(shù):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
?
總結(jié)
- 上一篇: 联想记忆计算机网络,什么是双向联想记忆神
- 下一篇: Python3 使用 pymysql 连