1、USE + 库名 :所选库名加粗
2、SELECT语句
SELECT + 字段名 AS + 字段别名 FROM + 表名 WHERE + 条件 ORDER BY + 字段名 DISTINCT :去重 ORDER BY :排序 字段名可以使用 ( + - * / )得到新的字段 字段名 + AS + 字段别名 eg: SELECT DISTINCT last_name, first_name AS 'first name', points, points + 10 * 100 AS discount_factor FROM customers ORDER BY last_name
3、WHERE语句
SELECT * FROM Customers WHERE points > 3000 SELECT * FROM Customers WHERE state = 'VA' SELECT * FROM Customers WHERE state <> 'VA' SELECT * FROM Customers WHERE DATA > '1999-12-01' SELECT * FROM Customers WHERE DATA > '1999-12-01' AND points > 1000 SELECT * FROM Customers WHERE NOT DATA > '1999-12-01' AND points > 1000 我们可以用 > >= < <= = != <> <>表示不等于 条件是字符串的要加'' AND 后加另一个条件 并且两个条件都成立 OR 后加另一个条件 并且两个条件成立一个就可以 AND 优先执行于 OR NOT 用来否定一个条件