From the course: SQL Essential Training
Solution: Concise track pricing report - SQL Tutorial
From the course: SQL Essential Training
Solution: Concise track pricing report
(upbeat music) - [Instructor] In this challenge, you've been asked by the management of Red 30 Tech to supply them with a report that lists both track names alongside their unit prices. Now, let's take a look at how we would respond to this request, starting with a comment block. We have within this block who's created the query, when it was created, and a short description of what the query does. Next, let's go down to the from clause where we've specified the track table. That's our first step. We've aliased this track table with the letter T. Now that we know what table we're going to within the select clause, we've specified the fields in this table we're interested in seeing in our result, and those fields are t.Name, which we have aliased as "Track Name." I want to point out that we've put a pair of double quotes around "Track Name" because this alias has a space between track and name. Next, we have a comma separating the next column we're interested in seeing, which is t.UnitPrice, and we've aliased this column as Price. Now, I'd like to point out again that in this case we're omitting any quotes around the alias Price because there's no space in this alias. With the select clause done, let's move on down to the order by clause where we've specified the name column as the column we wish to order are results by, and that is the t.Name. Last but not least, we have the limit clause, and we're limiting our results, or our rows, to 20. Now, let's hit test my code and observe our result. We can see here in our console output the 20 rows that we've expected, and we can now supply the management of Red 30 Tech with this report, which gives them what they've requested: a list of track names alongside their unit prices.
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.