课程: Hands-On SQL Challenges: Test Your Knowledge

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Solution: Print a menu

Solution: Print a menu

- [Instructor] To solve this challenge, I used the select keyword. The challenge asked for four specific fields, so I'll use those here in my select clause. These are Type, Name, Description, and Price. All of these fields come from the dishes table, so I'm using From Dishes Here to make that happen. The challenge asked for this information about dishes whose price was $6 or less, so to filter the results on that criteria, I wrote where price is less than or equal to six, and then we were asked to sort the output, not by one field, but by two. So in my order by clause, I have the first field we're sorting by which is type, and then a comma, and then name. This means that if there are records that come back with the same type, then the name field will be used to sort these. By using logic inequality operators in our query, we can narrow down the results that we get by specifying a condition and that lets us target the information we need. So I'll run this and there we go. It looks like…

内容