Workshop

The Workshop provides quiz questions to help you solidify your understanding of the material covered and exercises to provide you with experience in using what you've learned. Try to answer the quiz and exercise questions before checking the answers in Appendix A, "Answers to Quizzes and Exercises," and make sure you understand the answers before continuing to the next lesson.

Quiz

1:Can you use wildcards with IN, as in this example?
select ProductName, UnitPrice
from Products
where ProductName in ('%tofu%', '%cereal%', '%grain%')

2:When do you need to group conditions using parentheses?
3:In this query, is the sort order on the EmployeeID ascending or descending?
select EmployeeID, OrderDate, OrderID
from Orders
order by EmployeeID, OrderDate desc

4:In this query and result set featuring DISTINCT, why are there multiple rows with the value 'Sales Representative' in the title column? Isn't DISTINCT supposed to eliminate those duplicates?
select distinct title, lastname
from employees

title                          lastname
------------------------------ --------------------
Inside Sales Coordinator       Callahan
Sales Manager                  Buchanan
Sales Representative           Davolio
Sales Representative           Dodsworth
Sales Representative           King
Sales Representative           Leverling
Sales Representative           Peacock
Sales Representative           Suyama
Vice President, Sales          Fuller

Exercises

Note

In all these exercises, I'll ask you to find some fact or set of facts. I'll pose a problem, and then I'll provide you with the answer. If your results match mine, you probably found a correct method of resolving the query. In the answers, you'll see my SQL solution.


1:List all customers in Mexico. How many are there?
2:Find Andrew Fuller's home phone number.
3:What product costs the same as Chang?
4:Produce a list of different countries shipped to in May 1998.
5:Find the youngest employee. When was he or she born?
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset