课程: Hands-On SQL Challenges: Test Your Knowledge
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Find books to feature for an event - SQL教程
课程: Hands-On SQL Challenges: Test Your Knowledge
Solution: Find books to feature for an event
- [Instructor] This challenge has a few components, and here's how I solved it. We were asked to find the quantity or count of books which were published in a specific range of years, so I'm using the COUNT of the Title with an alias of Qty for quantity, like the challenge asked, and then the Title field itself. These values come from the Books table. To find the books that were published in the 1890s, I used the BETWEEN operator to set an inclusive range of values as my WHERE condition. In our database, the published value is an integer. Next, I need to ensure that the books within that range are actually available in the library and that they're not checked out to a patron. So I'm using the AND operator here with WHERE to add another condition. That condition is that the BookID is not found in the list of books with NULL return dates. This subquery returns a list of books that aren't available in the library, and then the WHERE clause checks whether the expression BookID NOT IN that…
内容
-
-
-
-
(已锁定)
Solution: Check book availability1 分钟 41 秒
-
(已锁定)
Solution: Add new books to the library1 分钟 39 秒
-
(已锁定)
Solution: Check out books2 分钟 11 秒
-
(已锁定)
Solution: Check for books due back1 分钟 42 秒
-
(已锁定)
Solution: Return books to the library2 分钟 10 秒
-
(已锁定)
Solution: Encourage patrons to check out books1 分钟 21 秒
-
(已锁定)
Solution: Find books to feature for an event1 分钟 29 秒
-
(已锁定)
Solution: Book statistics2 分钟 48 秒
-
(已锁定)
-