Sakila I

Estimated Time: 1 - 2 hours
Objectives:
  • To create basic select queries
  • To apply filter, order clauses and wildcards
  • To practice formulating logic in query problems

Let's get your hands wet and have you start drafting some SQL statements.  Here is a sample database called Sakila.  Download the file (sakila.sql) and find a way to execute this file and import this data to your own MySQL database.  This is one of the sample database that MySQL community provided and we'll use this database to practice some SQL statements.  For the current exercise, let's have you focus on the customer table only.

For now, don't worry about the city, country, or address table.  Once you level up, you'll learn how to join these table data with the customer data.

SELECT Statement Practices

Write a query for each of these tasks:

  1. Retrieve customer information (all fields) where customer_id is 20
  2. Retrieve customer information (all fields) where customer_id is BETWEEN 20 and 60
  3. Retrieve customer information (all fields) WHERE first_name starts with L
  4. Retrieve customer information (all fields) WHERE first_name includes L.
  5. Retrieve customer information (all fields) WHERE first_name ends with L
  6. Retrieve customer information (all fields) WHERE last_name starts with C and have the results be shown, starting with the record where it was created most recently.<...
Please submit your assignment before moving to the next lesson. chevron_left Prev Nextchevron_right