SELECT
语法:
SELECT column_name, column_name FROM table_name
SELECT DISTINCT
SELECT DISTICT语句用于返回唯一不同的值。
语法:
SELECT DISTICT column_name, column_name FROM table_name
WHERE
WHERE 子句用来提取那些满足指定标准的记录
=:等于
<>:不等于(有些SQL的版本中是'!=')
>:大于
<:小于
>=:大于等于
<=:小于等于
BETWEEN:在某个范围内
LIKE:搜索某种模式
IN:指定针对某个列的多个可能的值
AND&OR
AND&OR运算符用于基于一个以上条件对记录进行过滤。
ORDER BY
ORDER BY 用来对结果集进行排序。
对结果集的排序可以是一列也可以是多列;
默认是升序,降序要用DESC关键字。
语法:
SELECT * FROM table_name ORDER BY column_name, column_name ASC | DESC
INSERT INTO
语法:
1. INSERT INTO table_name VALUES (values1, values2,values3,...)
2. INSERT INTO table_name (column1,column2,column3,...)
VALUES (value1,value2,value3,...)
UPDATE
UPDATE 用来更新表中已存在的记录。
语法(update set):
UPDATE table_name SET column1 = value1, column2 = value2,...
WHERE some_column = some_value
DELETE
语法:
DELETE FROM table_name WHERE some_column = some_value