课程: SQL Server Fundamentals: Master Basic Query Techniques
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Inner joins
(upbeat music) - [Instructor] In this solution, I need to get access to data from a couple different tables. So I'm going to start by writing my join conditions. We'll add a table alias for Orders, and then INNER JOIN to the Customer table AS c. And then our join condition here is going to be the CustomerId, since those are shared in both tables. And then we're going to add the Salesperson table as well AS s on the SalespersonID from the Orders table and the Salesperson table. Now I can add my filtering. I know I only want orders where the Status = past due and the Salesperson, so s, LastName = Hall. So now that I have the correct data set, I'm going to specify which columns I want. So I need the OrderId. And then to get the customer name, I'm going to use the CONCAT function to combine the FirstName, make sure I include a space so those values don't get squished together, the LastName, and then give that column alias of CustomerName. I also need the customer's Email, the TotalDue…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。