Exercises

  1. Define and give examples of the following database terms: tuple, attribute, relation.

  2. What does it mean to normalize a database design? Describe first, second, and third normal forms.

  3. Reinforce your knowledge by reviewing the basic SQL course at www.sqlcourse.com. It allows you to formulate and run SQL queries online.

  4. Write an SQL statement to display the name and age of everyone in the Person table who is older than 39.

  5. Write an SQL statement to display the name of everyone in the Person table who lives in a NATO country and listens to the Beatles. There are 19 member nations of the North Atlantic Treaty Organization, including the USA, UK, Canada, France, Germany, Greece, and Poland. New members join from time to time, so top students will keep the list in a table, rather than a set of literals.

  6. What is an SQL subquery, and when would you use one?

  7. Write an SQL statement to display the name of everyone in the Person table who lives in a NATO country and does not listen to the Beatles. Be careful to exclude people who listen to the Beatles, and also listen to other bands as well. The simplest way to do this is to use a subquery.

  8. Explain, using examples, the difference between a primary key and a foreign key.

..................Content has been hidden....................

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