课程: SQL Server Fundamentals: Master Basic Query Techniques
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Subqueries
- [Instructor] As we've discussed, one of the functions of inner joins is that they can be used to filter results sets, but there is another method that we can use to achieve this called a subquery. So we're going to use a subquery to get us the results we need to get all of the names for customers who live in Boston. So first let's start by running a query that will get us all of the customer names. And we know from our previous examples that that's going to be from the customer table. So we're going to select star from dbo.customer, and we're going to go ahead and give this a table alias. So let's run that and look at our data once again. We don't have the city name in this table so we can't filter on that condition right now. But if we can get access to information from the city_state_zip table, we can apply those filters. So what we're going to do is we're going to select star from dbo.city_state_zip.…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。