1. select
查询一个表的所有结果集。
select * from Persons
2.关键词 DISTINCT 用于返回唯一不同的值
SELECT DISTINCT FirstName FROM Persons
3.WHERE
SELECT * FROM Persons WHERE City = 'Beijing'
4.AND 和 OR运算符
SELECT * FROM Persons WHERE (LastName = 'Bush' or LastName = 'David') and FirstName = 'George'
5.ORDER BY 语句用于对结果集进行排序
默认ASC升序,DESC 降序
SELECT City FROM Persons ORDER BY City DESC
6.INSERT
插入新的行:
INSERT INTO Persons VALUES (5,'Gates', 'Bill', 'Xuanwumen 10', 'Beijing')
向指定的列插入数据:
INSERT INTO Persons (Id_P,LastName, Address) VALUES (6,'Wilson', 'Champs-Elysees')
7.UPDATE
更新某一行中的若干列:
UPDATE Persons SET Address = 'Zhongshan 23', City = 'Nanjing' WHERE LastName = 'Wilson'
8.DELETE
删除某行:
DELETE FROM Persons WHERE LastName = 'Wilson'