From the course: Microsoft SQL Server 2022 Essential Training
Unlock this course with a free trial
Join today to access over 24,100 courses taught by industry experts.
Solution: Query data in a database - SQL Server Tutorial
From the course: Microsoft SQL Server 2022 Essential Training
Solution: Query data in a database
(upbeat music) - [Instructor] In this challenge, we're given a table of products sold by a coffee roaster, and we need to produce a query that retrieves just the information of interest to the shipping department manager. And we can start by saying SELECT, that's our keyword to grab columns from a data table. And I'll use the shortcut SELECT *, which will just mean to grab all of the columns and then we specify where they're coming from. So from the ProductCatalog table. We'll finish our statement with a semicolon at the end. And if I test it out, we'll see everything that's in that ProductCatalog table and we can see that it returns a total of 12 columns. Now the challenge says that we are only interested in getting the columns that are needed by the shipping department manager. So we can see there's lots of information here, including the product category and the brand, the description, the shipping manager doesn't care about any of that information. They just want to see what's in…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Understand the role of T-SQL2m 40s
-
(Locked)
Use the T-SQL editor6m 49s
-
(Locked)
Create a table with T-SQL6m 33s
-
(Locked)
Solution: Create tables with T-SQL commands3m 46s
-
(Locked)
Add data to a table4m 58s
-
(Locked)
Solution: Add data with T-SQL commands3m 4s
-
(Locked)
Retrieve records with SELECT4m 3s
-
(Locked)
Solution: Query data in a database2m 7s
-
(Locked)
Filter returned results with WHERE3m 12s
-
(Locked)
Sort records2m 54s
-
(Locked)
Solution: Filter and sort data with a query4m 27s
-
(Locked)
Delete records from a table4m 31s
-
(Locked)
Update records in a table2m 3s
-
(Locked)
Solution: Remove and update records in a table6m 11s
-
(Locked)
Joining related tables4m 32s
-
(Locked)
Solution: Query information from related tables5m 33s
-
(Locked)
Remove a table from the database5m 7s
-
-
-
-
-
-