课程: Coding Exercises: SQL Data Science
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Sorting and grouping query results
(video game tune) - [Instructor] It's Tom again, and this time he is doing a gender-based analysis. He needs you to inform him about the latest split of fans for each gender in percentage terms. Now, this will translate into the challenge where you need to find out the fans distribution per gender in percentage terms for the latest date. Now, in order to calculate the percentage, you need to calculate the total number of fans per gender, and you will need to know what are the total number of fans that are there in your table. Now, if you break it down further, you'll first have to write a subquery to compute the total number of fans from the table fans per gender age, then you can use the round function to display the percentage til two decimal places. Then you would need to filter the data for the latest date. And lastly, you will have to use the group by clause so that you can group the data for each gender. So at…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。