From the course: Querying Microsoft SQL Server 2022
Unlock the full course today
Join today to access over 24,200 courses taught by industry experts.
Challenge: Write a SELECT query - SQL Server Tutorial
From the course: Querying Microsoft SQL Server 2022
Challenge: Write a SELECT query
(upbeat funky music) - [Tutor] Now that you've seen a few of the clauses that make up a SQL select query, it's time to put that knowledge to the test with our first challenge. In the AdventureWorks database there's a table called production.WorkOrder. This table stores information about the production of the items that AdventureWorks manufacturers. Now unfortunately, sometimes the manufacturing process encounters a problem, and products need to be discarded or scrapped. I want you to find all of the work orders from the month of December, 2013 that had a scrapped quantity above zero units. Then, sort the results descending, so that the work orders that had the highest number of scrapped items, appear at the top of the results. I will give you one hint here. In SQL server, dates are treated like text strings, so you'll want to write them out in single quotation marks in your query predicates. And use the year, month…
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
-
-
-
What is Transact SQL?3m 22s
-
(Locked)
The SQL querying environment8m 6s
-
(Locked)
Return records with SELECT and FROM8m 45s
-
(Locked)
Filter records with WHERE4m 42s
-
(Locked)
Sort records with ORDER BY2m 57s
-
(Locked)
Column aliases2m 24s
-
(Locked)
Create values with constants and math4m 22s
-
(Locked)
Challenge: Write a SELECT query1m 15s
-
(Locked)
Solution: Write a SELECT query4m 14s
-
(Locked)
Solution: Query information from a database5m 32s
-
-
-
-
-
-
-
-
-
-