SQL SELECT 语句
SELECT 列名称 FROM 表名称
SELECT LastName,FirstName FROM Persons
SELECT * FROM Persons
SQL SELECT DISTINCT 语句
SELECT DISTINCT 列名称 FROM 表名称
SELECT DISTINCT Company FROM Orders
SQL WHERE 子句
SELECT 列名称 FROM 表名称 WHERE 列 运算符 值
SELECT * FROM Persons WHERE City='Beijing'
(注意BETWEEN LIKE)
SQL AND & OR 运算符
SELECT * FROM Persons WHERE (FirstName='Thomas' OR FirstName='William')AND LastName='Carter'
SQL ORDER BY 子句
SELECT Company, OrderNumber FROM Orders ORDER BY Company, OrderNumber
SELECT Company, OrderNumber FROM Orders ORDER BY Company DESC, OrderNumber ASC
SQL INSERT INTO 语句
INSERT INTO 表名称 VALUES (值1, 值2,....)
INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....)
INSERT INTO Persons VALUES ('Gates', 'Bill', 'Xuanwumen 10', 'Beijing')
INSERT INTO Persons (LastName, Address) VALUES ('Wilson', 'Champs-Elysees')
Update 语句
UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值
UPDATE Person SET Address = 'Zhongshan 23', City = 'Nanjing'WHERE LastName = 'Wilson'
SQL DELETE 语句
DELETE FROM 表名称 WHERE 列名称 = 值
(SQL 使用单引号来环绕文本值 数值不用引号)