以下是一些经典SQL语句,适合快速入门与学习:
- SELECT 查询所有列:
SELECT * FROM table_name;
- WHERE 条件查询:
SELECT column1, column2 FROM table_name WHERE condition;
- INSERT INTO 插入数据:
INSERT INTO table_name (column1, column2) VALUES (value1, value2);
- UPDATE 更新数据:
UPDATE table_name SET column1 = value1 WHERE condition;
- DELETE 删除数据:
DELETE FROM table_name WHERE condition;
- JOIN 连接查询:
SELECT column1, column2 FROM table1 JOIN table2 ON table1.id = table2.id;
- GROUP BY 分组查询:
SELECT column, COUNT(*) FROM table_name GROUP BY column;
- ORDER BY 排序:
SELECT column1, column2 FROM table_name ORDER BY column1 DESC;
通过掌握这些经典SQL语句,你可以进行各种数据库操作,快速进行数据查询与管理。