课程: Coding Exercises: SQL Data Science
Column selection
- [Narrator] Being in the publishing business, your organization posts regularly on social media to promote the content of their contributors. The marketing head, Alex has been working on a presentation for the investors, and he has reached out to you to extract the post insights from the database. He wants to look at the data on how the posts are performing on Facebook, especially the recent ones first. So here's the challenge for you. You need to extract post insights from the database, such that we look at the latest posts first. So as per his email, you are required to give the following information about each post. Created time, engaged fans, post clicks, reach and impressions. Now at this point, try to write the SQL query to extract the information from the database. Pause the video and once you are done, I'll show you how I solve this challenge. So here I am in my query editor and I'll start writing this query, using the select clause. Then I would need to specify what all information I need from this table. So all the variables or the column names. So as discussed, I need created time, engaged fans, then I'd need post clicks, reach and lastly, impressions. Now I need to tell the database from which table I need this information. So, from, then the table name, which is post insights, and Alex has mentioned that he wants to look at the recent post first. So we need to order this data by created time and that too, in the descending order. So if we run this query now, we've got the data. So the result of this query is basically created time, engaged fans, post clicks, reach and impressions. So all the information that was requested and the created time, if you see over here, it's actually ordered in the manner that we see the latest post first. So this is how I could extract the data that was requested by Alex.
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。