跳到主要内容

SQL

方言是 MySQL

参考: https://www.runoob.com/sql/sql-tutorial.html

SELECT DISTINCT

SELECT 结果去重

SELECT DISTINCT column1, column2, ...
FROM table_name;

LIMIT

限制返回的行数

SELECT column_name(s)
FROM table_name
LIMIT number;

LIKE

通配符描述
%任意 0 个或多个字符
_任意一个字符
[charlist]charlist 中的任意一个字符
[^charlist]或 [!charlist]不在 charlist 中的任意单一字符

IN

SELECT column1, column2, ...
FROM table_name
WHERE column IN (value1, value2, ...);

BETWEEN

SELECT column1, column2, ...
FROM table_name
WHERE column BETWEEN value1 AND value2;

JOIN