0人加入学习
(0人评价)
SQL课程
价格 $99,999美元
该课程属于 商业/数据分析师培养计划(2021年5月) 请加入后再学习

SQL 4:

1. CASE WHEN condition 1 THEN result 1

            WHEN condition 2 THEN result 2

             ELSE result 3 END AS column_name

2. Using CASE with aggregate functions:

Write a query containing the CASE statement first, then COUNT, SUM, AVG......

3. Using CASE inside of aggregate functions (Pivoting)

COUNT (CASE WHEN)

4. DISTINCT: used for viewing unique values.

include multiple columns in a SELECT DISTINCT clause, the results will contain all of the unique pairs of those columns.

注:include DISTINCT once in the SELECT clause

particularly helpful when exploring a new data set. 

using DISTINCT in aggregations-

COUNT DISTINCT

COUNT (DISTINCT CASE WHEN.....)

using DISTINCT, particularly in aggregations, can slow your queries down quite a bit.

5. JOIN: working with data from multiple tables

SELECT * 

FROM a table JOIN another table ON....

重命名不用加AS

 

 

[展开全文]

授课教师

Yuhan老师

课程特色

视频(5)

学员动态

Sun0422 开始学习 SQL 5
Sun0422 开始学习 SQL 3
Sun0422 开始学习 SQL 4
horace 加入学习
Sun0422 开始学习 SQL 2