SQL 常用语句收集
1、UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值
2、SELECT * FROM TableA INNER JOIN TableB ON TableA.name = TableB.name WHERE 列名称 = 某值 //其中on是连接条件,where是连接后的筛选条件
3、SELECT * FROM TableA LEFT OUTER JOIN TableB ON TableA.name = TableB.name
4、SELECT * FROM TableA RIGHT OUTER JOIN TableB ON TableA.name = TableB.name
5、SELECT column_name(s) FROM table_name1 UNION SELECT column_name(s) FROM table_name2 //UNION 操作符选取不同的值 ,重复的值会去掉
6、SELECT column_name(s) FROM table_name1 UNION ALL SELECT column_name(s) FROM table_name2 //UNION ALL 操作符会保留重复的值