Home >> FAQs/Tutorials >> SQL Server FAQ
SQL Server FAQs - Understanding SELECT Statements with Joins and Subqueries
A collection of 17 FAQs on SELECT statements with joins and subqueries. Clear answers are provided with tutorial exercises on joining multiple tables with inner and outer joins; using subqueries with IN, EXISTS, and FROM clauses; using UNION operations.
Topics included in this FAQ are:
- How To Join Two Tables in a Single Query?
- How To Write a Query with an Inner Join?
- How To Define and Use Table Alias Names?
- How To Write a Query with a Left Outer Join?
- How To Write a Query with a Right Outer Join?
- How To Write a Query with a Full Outer Join?
- How To Write an Inner Join with the WHERE Clause?
- How To Name Query Output Columns?
- What Is a Subquery in a SELECT Query Statement?
- How To Use Subqueries with the IN Operators?
- How To Use Subqueries with the EXISTS Operators?
- How To Use Subqueries in the FROM Clause?
- How To Count Groups Returned with the GROUP BY Clause?
- How To Return the Top 5 Rows from a SELECT Query?
- How To Return the Second 5 Rows?
- How To Use UNION to Merge Outputs from Two Queries Together?
- How To Use ORDER BY with UNION Operators
Please note that all answers and tutorials are based on MS SQL Server 2005.
To follow tutorials in this collection, you should connect to SQL server
as a regular user who has enough permissions to create table and insert date in "FyiCenterData".
It is assumed that you are using the temporary database, FyiCenterData, created in previous
Some sample scripts require database tables created by other samples in the beginning of the collection.
For questions on SELECT statement basics and GROUP BY, see the previous FAQ collection.
(Continued on next topic...)