课程: SQL Practice: Basic Queries
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Retrieve data from multiple tables
- [Instructor] This code challenge is going to use two tables for my database, the Customers table and the Reservations table. The tables are linked on a foreign key, a one-to-many relationship where each customer can have one or more reservations. In the beginning code, I'm just selecting from the Reservations table, and when I click Test my code, I get back a whole lot of data, but not too much context. Now, I'm going to paste in my solution. First of all, I'm getting data from two different tables, the Reservations and the Customers table, and I'm using an INNER JOIN, meaning I'm connecting the two parts of the foreign key together, and I'm connecting on the CustomerID columns of each of the two tables. I'm sorting the return to data by the Date in descending order, so I'll see the newest reservation first. And I'm only going to retrieve two reservations. That's done with the TOP 2 clause in the SELECT statement.…
内容
-
-
-
Solution: Get sorted data from a table1 分钟 35 秒
-
(已锁定)
Solution: Retrieve data from multiple tables1 分钟 29 秒
-
(已锁定)
Solution: Retrieve data filtered on a range1 分钟 41 秒
-
(已锁定)
Solution: Retrieve aggregated data2 分钟 12 秒
-
(已锁定)
Solution: Get data filtered with a string pattern1 分钟 31 秒
-
(已锁定)
Solution: Find the most expensive order1 分钟 55 秒
-
(已锁定)
Solution: Find the average of orders2 分钟 5 秒
-
-