课程: SQL Hands-On Practice: Solve Business Problems

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Solution: Timestamp differences with LEAD()

Solution: Timestamp differences with LEAD()

- [Instructor] Now that you've had a chance to work on this timestamp problem on your own, let's work on it together. Here's how I would approach it. Let's start with pulling all of the columns in the payment status log table, and filter for subscription ID 38844. Typically, you don't want to select star too often in SQL because it's better for optimization to only pull the specific columns you need. But since we're investigating statuses for a client, we're going to want to pull everything so we have more data to look into. We're going to start with a select star, and we're pulling this data from the payment status log table, and we're filtering for a certain subscription ID. So we're going to need the WHERE clause, and we're filtering for subscription ID 38844. And remember to put this in single quotes because the query's not going to work without it since our subscription IDs are text data type. Finally, we're…

内容