mysql的简单查询语句
时间: 2023-10-14 16:13:59 浏览: 90
sql简单查询语句[参考].pdf
以下是一些MySQL的简单查询语句:
1. 选择所有列和所有行:
```
SELECT * FROM table_name;
```
2. 选择特定列和所有行:
```
SELECT column1, column2, ... FROM table_name;
```
3. 选择特定行和所有列:
```
SELECT * FROM table_name WHERE condition;
```
4. 对结果进行排序:
```
SELECT * FROM table_name ORDER BY column_name ASC|DESC;
```
5. 对结果进行分组:
```
SELECT column_name, COUNT(*) FROM table_name GROUP BY column_name;
```
6. 连接两个或多个表:
```
SELECT * FROM table1 JOIN table2 ON table1.column_name = table2.column_name;
```
7. 对结果进行聚合(例如,求和、平均值、最小值、最大值等):
```
SELECT SUM(column_name) FROM table_name;
```
以上是一些常用的MySQL查询语句,但并不是全部。具体语句的使用需要根据具体情况进行调整。
阅读全文