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

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…

Contents