课程: SQL Hands-On Practice: Solve Business Problems
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Create aggregated columns with CASE - SQL教程
课程: SQL Hands-On Practice: Solve Business Problems
Solution: Create aggregated columns with CASE
- [Instructor] Tracking front end events is a really cool project that can actually make a huge impact in product analytics and A/B testing. Also, being able to pivot data using case is a true superpower in SQL. This use case comes in handy for me all the time. So let's jump in. Let's first write the base of the query by joining the front end event log table and the front end event definitions table. We'll start out with select, and we're going to use star for a placeholder for now. Then we're going to bring in the front end event log table. And this is a pretty long table name, so we're going to call it EL for short. Then we're going to need a join, and we're going to join the front end event definitions table, and we'll call this def for short. We can use an inner join here, because we know that all of the events logged in the front end event log table are also in the front and event definitions table. So we're…