SELECT
SELECT * FROM 表名称
SELECT * FROM Persons
SELECT 列名1,列名2 FROM 表名称
SELECT LastName,FirstName FROM Persons
SELECT DISTINCT 列名称 FROM 表名称(返回不同的值)
SELECT DISTINCT Company FROM Orders
SELECT 列名称 FROM 表名称 WHERE 列 运算符 值
SELECT * FROM Persons WHERE City='Beijing'
SELECT * FROM Persons WHERE Year>1965
SELECT * FROM Persons WHERE FirstName='Thomas' AND LastName='Carter'
SELECT * FROM Persons WHERE firstname='Thomas' OR lastname='Carter'
SELECT * FROM Persons WHERE (FirstName='Thomas' OR FirstName='William') AND LastName='Carter'
SELECT Company, OrderNumber FROM Orders ORDER BY Company
SELECT Company, OrderNumber FROM Orders ORDER BY Company, OrderNumber
SELECT Company, OrderNumber FROM Orders ORDER BY Company DESC(默认升序)
SELECT Company, OrderNumber FROM Orders ORDER BY Company DESC, OrderNumber ASC
INSERT
INSERT INTO 表名称 VALUES (值1, 值2,....)
INSERT INTO Persons VALUES ('Gates', 'Bill', 'Xuanwumen 10', 'Beijing')
INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....) (指定列中插入数据)
INSERT INTO Persons (LastName, Address) VALUES ('Wilson', 'Champs-Elysees')
UPDATE
UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值
UPDATE Person SET FirstName = 'Fred' WHERE LastName = 'Wilson'
UPDATE Person SET Address = 'Zhongshan 23', City = 'Nanjing' WHERE LastName = 'Wilson'
DELETE
DELETE FROM 表名称 WHERE 列名称 = 值
DELETE FROM Person WHERE LastName = 'Wilson'
DELETE FROM 表名称(删除所有行。表的结构、属性和索引都是完整的)
DELETE FROM table_name
DELETE * FROM table_name