SELECT
一句话解释
SELECT 是 SQL command 那个读取数据从 数据库 — 它 specifies 哪个列 到返回 and 从哪个表.
用大白话说
SELECT is the most common SQL command. It retrieves rows from one or more tables and returns them as a result set. The basic form is:
SELECT column1, column2 FROM table_name;
You can filter rows with WHERE, sort with ORDER BY, limit with LIMIT, aggregate with GROUP BY, and join with JOIN. The * wildcard selects all columns.
SELECT never modifies data — it is read-only. This makes it safe to experiment with. The order of clauses matters: SELECT → FROM → WHERE → GROUP BY → HAVING → ORDER BY → LIMIT.
示例
sql
-- Select specific columns, filter, and sort
SELECT name, email
FROM users
WHERE active = TRUE
ORDER BY created_at DESC
LIMIT 10;返回 name and email 的 10 大多数 recently 创建 active 用户.
相关术语
相关资源
相关课程
- 选择查询
学习 SELECT 语句 in 深度.
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。