Skip to content

Commit

Permalink
update(sql/07/2): 添加更多常用语句
Browse files Browse the repository at this point in the history
  • Loading branch information
Leetfs committed Oct 15, 2024
1 parent e0406a9 commit 9f4440f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions docs/sql/07/2.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,37 @@ from SC
where between 70 and 79
```

## distinct
distinct 去除重复值
### 例:查询学生来自哪些城市

```sql
select distinct address
from ST
```

### 查询有人选修的课程的课程数

```sql
select count(distinct SCid)
from SC
```

## count

### 例:查询城市数量

```sql
select count(distinct address)
from ST
```

## AVG(平均值)

### 例:查询特定课程id下的平均值

```sql
select AVG(chengji)
from SC
where SCid = '111100'
```

0 comments on commit 9f4440f

Please sign in to comment.