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.
Solution: Query information from a database - SQL Server Tutorial
From the course: Querying Microsoft SQL Server 2022
Solution: Query information from a database
(upbeat music) - [Presenter] In this challenge, we are given a table of some maintenance requests for a residential repair company, and we need to retrieve some of the information. So we're going to just start by selecting everything from the table, just so I can see what we have to work with. So we'll SELECT * FROM MaintenanceRequests, and I'll test my code to see what we have. So here are the different columns of data and all the rows from the table that we can work with. So we have all of these different columns. Now, the challenge is asking us for a specific subset of columns, so I don't want to return everything. I just want to retrieve the TenantName column, (keys typing) and I'll just put these in here one at a time on each line. The next one was IssueDescription. (keys typing) We wanted the CompletionDate, (keys typing) the CostEstimate, (keys typing) and the BillingStatus columns, (keys typing) So fill in all of those in the SELECT statement, we'll run it again, and this time…
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
-
-
-
-
-
-
-
-
-
-