mysql中sql语句
<數據定義語言DDL>
一. create TABLE tableName 創建表
二. alter TABLE tableName 修改表
三. drop TBALE tableName 刪除表
<數據控制語言DCL>
GRANT/REVOKE
<數據操縱語言DML>
一. insert?INTO tableName(,,,) values(,,,); 插入數據(增)
二. update tableName SET =, =, =; 更新數據(改)
三. delete FROM tableName; 刪除數據(刪)
<數據查詢語言DQL>
一. select ... FROM tableName(查)
1. select語句
select id,productId,apiId ?from SureMesure limit 1 \G;
注意點:字段之間用逗號隔開,limit用于限制顯示記錄數量,\G用于格式化輸出
2.select ...group by...having...
select apiId, AVG(execTime) from apisUsabilityTestHistory where execTime<>0 group by apiId having AVG(execTime)>5;
注意點:group by 用于分組,AVG(execTime)組內求平均值, having 用于過濾組結果。分組后求各個組的平均值。
3. 條件判斷null,前面不能用=,!=,<>。
而要用 is null 或者is not null
4.沒有默認值的空字段
='';
5.雙重select(性能差于連接)
select * from t_order where order_id in (select distinct order_id from t_order_flow where sync_id=0);
轉載于:https://www.cnblogs.com/shijianchuzhenzhi/p/4684290.html
總結
以上是生活随笔為你收集整理的mysql中sql语句的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C#_Socket网络编程实现的简单局域
- 下一篇: 定义CSS