课程: Hands-On SQL Challenges: Test Your Knowledge
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Encourage patrons to check out books - SQL教程
课程: Hands-On SQL Challenges: Test Your Knowledge
Solution: Encourage patrons to check out books
- [Instructor] This challenge asked us to find information about people who checked out only one book in the year 2024. Here's how I solved this challenge. I need to return information from the database, so I used a SELECT statement. And the values that I'm returning are a count of loans with an alias LoanCount as the challenge requested. And then the patron's first name and email address to make it easy to feed these results into our email system to generate reminder emails. We'll need information from the Loans table. And I'll join this to the Patrons table to get the other two fields. To find loans that were made in 2024, I'm using my WHERE clause here with a BETWEEN statement and the first and last days of the year. This will find any record with a loan date in 2024. Because I'm counting values from the Loans table, I need to group by patron ID so I can get account of loans for each patron. The challenge asked us to look for patrons who borrowed only one book, no more, no less. So…
内容
-
-
-
-
(已锁定)
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 秒
-
(已锁定)
-