Use Cases for Subqueries
Explore how to apply subqueries in T-SQL for different scenarios such as filtering data with WHERE clauses, adding related data as separate columns, and using subqueries as data sources. Gain practical understanding by working with example queries from a Tournament database.
We'll cover the following...
We'll cover the following...
The use of subqueries is not limited to insertion. Subqueries can be used in a variety of scenarios.
The Tournament database
To demonstrate different use cases of subqueries, we’ll use the Tournament database, which consists of these tables:
-
ActionPointsstores points earned by a player for some in-game action:Id: Uniquely identifies each action performed within a game.PlayerId: References theIdcolumn of thePlayerstable.Points: represented the number of points earned.
-
Playersstores information about players participating in the game:Id: Uniquely identifies each