{
SELECT*FROM products
WHERE quantity_in_stock IN (49,38,72) -- quantity=49 OR 38 OR 72
}
BETWEEN
{
SELECT*FROM customers
WHERE birth_date BETWEEN'1990-01-01'AND'2000-01-01'
}
LIKE
{
SELECT*FROM customers
WHERE last_name LIKE'%b%'-- % represent any number of characters---SELECT*FROM customers
WHERE last_name NOTLIKE'b____y'-- _ represent single characters---SELECT*FROM customers
WHERE address LIKE'%trail%'OR
address LIKE'%avenue%'
}
REGEXP(正则表达式)
{
SELECT*FROM customers
WHERE last_name REGEXP 'field$|^mac|rose'-- ^ beginning $ end | logical OR---SELECT*FROM customers
WHERE last_name REGEXP 'e[gim]'-- 等价于eg OR ei OR em---SELECT*FROM customers
WHERE last_name REGEXP '[a-h]e'-- from a to h和e组合,等价于ae OR be OR ce …OR he
}
IS NULL
{
SELECT*FROM customers
WHERE phone ISNOTNULL
}
ORDER BY
{
SELECT*FROM customers
ORDERBY state DESC,first_name -- DESC 降序---SELECT first_name,last_name
FROM customers
ORDERBY birth_date
---SELECT first_name,last_name,points
FROM customers
ORDERBY1,2-- 表示用相对列顺序排序,对应SELECT的顺序,这里等价于ORDER BY first_name,last_name---SELECT*,
quantity*unit_price AS total_price
FROM order_items
WHERE order_id=2ORDERBY total_price DESC
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步