课程: SQL Hands-On Practice: Solve Business Problems
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Timestamp differences with LEAD() - SQL教程
课程: SQL Hands-On Practice: Solve Business Problems
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…
内容
-
-
-
-
-
-
-
(已锁定)
Pulling the most recent sales data2 分钟 23 秒
-
(已锁定)
Rank(), row_number(), and dense_rank()2 分钟 55 秒
-
(已锁定)
Pulling the most recent sale with row_number()3 分钟 31 秒
-
(已锁定)
Introduction to window functions3 分钟 30 秒
-
(已锁定)
Solution: Get running totals with window functions6 分钟 22 秒
-
(已锁定)
Solution: Timestamp differences with LEAD()6 分钟 54 秒
-
(已锁定)
-