MySQL Tutorial

Mysql database, mysql references, mysql examples, mysql exercises.

You can test your MySQL skills with W3Schools' Exercises.

We have gathered a variety of MySQL exercises (with answers) for each MySQL Chapter.

Try to solve an exercise by filling in the missing parts of a code. If you're stuck, hit the "Show Answer" button to see what you've done wrong.

Count Your Score

You will get 1 point for each correct answer. Your score and total score will always be displayed.

Start MySQL Exercises

Start MySQL Exercises ❯

If you don't know MySQL, we suggest that you read our MySQL Tutorial from scratch.

Get Certified

COLOR PICKER

colorpicker

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail: [email protected]

Top Tutorials

Top references, top examples, get certified.

Home » Getting Started with MySQL » MySQL Sample Database

MySQL Sample Database

We use the classicmodels database as a MySQL sample database to help you work with MySQL quickly and effectively.

The classicmodels database is a retailer of scale models of classic cars. It contains typical business data, including information about customers, products, sales orders, sales order line items, and more.

We’ll use this sample database in our MySQL tutorials to demonstrate a wide range of MySQL features, from simple queries to complex stored procedures .

Download MySQL Sample Database

You can download the sample database from the following link:

The download file is in ZIP format, so you’ll need a zip program to unzip it. You can download a free zip program at www.7-zip.org .

After uncompressing the sampledatabase.zip file, you can load the sample database into the MySQL database server by following the tutorial on how to do so.

MySQL Sample Database Schema

The MySQL sample database schema consists of the following tables:

  • customers : stores customer’s data.
  • products : stores a list of scale model cars.
  • productlines : stores a list of product lines.
  • orders : stores sales orders placed by customers.
  • orderdetails : stores sales order line items for every sales order.
  • payments : stores payments made by customers based on their accounts.
  • employees : stores employee information and the organization structure such as who reports to whom.
  • offices : stores sales office data.

The following picture illustrates the ER diagram of the sample database:

MySQL Sample Database

You can download the MySQL sample database ER diagram in PDF format from the following link:

Download MySQL Sample Database Diagram PDF A4

We recommend printing out the ER diagram and placing it on your desk to help you become familiar with the schema as you learn MySQL.

Have fun learning MySQL!

StackHowTo

  • MySQL Practice Exercises with Solutions – Part 1

W e have split this collection of exercises on MYSQL into seven parts, this is the first one , then you will find the second part , the third part , the fourth part , the fifth part , the sixth part , seventh part , eighth part , and finally the ninth part these exercises are based on simple, advanced and finally complex MYSQL queries. These questions are based on the following two tables, Employee table and Reward table.  

Employee table

Reward table.

  [st_adsense]  

1. Get all employees.

mysql database assignment

    2. Display the first name and last name of all employees.

mysql database assignment

    3. Display all the values of the “First_Name” column using the alias “Employee Name”

mysql database assignment

    4. Get all “Last_Name” in lowercase.

mysql database assignment

    5. Get all “Last_Name” in uppercase.

mysql database assignment

  [st_adsense]   6. Get unique “DEPARTMENT”.

mysql database assignment

    7. Get the first 4 characters of “FIRST_NAME” column.

mysql database assignment

    9. Get all values from the “FIRST_NAME” column after removing white space on the right.

mysql database assignment

    10. Get all values from the “FIRST_NAME” column after removing white space on the left.

mysql database assignment

    11. Write the syntax to create the “employee” table.

MySQL CREATE TABLE

  • MYSQL MCQ and Answers – Part 1
  • MYSQL MCQ and Answers – Part 2
  • MYSQL MCQ and Answers – Part 3
  • MYSQL MCQ and Answers – Part 4
  • MYSQL MCQ and Answers – Part 5
  • MYSQL MCQ and Answers – Part 6

MYSQL MCQ and Answers – Query optimization

  • MySQL Practice Exercises with Solutions – Part 2
  • MySQL Practice Exercises with Solutions – Part 3
  • MySQL Practice Exercises with Solutions – Part 4

MySQL Practice Exercises with Solutions – Part 5

  • MySQL Practice Exercises with Solutions – Part 6
  • MySQL Practice Exercises with Solutions – Part 7

MySQL Practice Exercises with Solutions – Country Database – Part 8

  • MySQL Practice Exercises with Solutions – Ordering System Database – Part 9

You May Also Like

mysql-practice-exercises-with-solutions

One thought on “ MySQL Practice Exercises with Solutions – Part 1 ”

great platform to learn mysql

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

IMAGES

  1. MySQL Assignment Help

    mysql database assignment

  2. (DOC) MySQL Database Assignment

    mysql database assignment

  3. MySQL Practice Set

    mysql database assignment

  4. Solved Create MySQL Database Assignment Details You will use

    mysql database assignment

  5. MySQL Database Assignment Help Service Online Upto 50% OFF

    mysql database assignment

  6. MySQL Database Assignment Help All Around the Globe

    mysql database assignment

VIDEO

  1. Database Assignment Week 5 |express|mysql || PLP PLD 15

  2. MySQL Database Basics Lab Assignment

  3. PHP/MySQL: Using the Edit Operation to Update Data in a MySQL Database

  4. MYSQL Functions

  5. [NEW 2024] Migrate to Cloud SQL for PostgreSQL using Database Migration Service #qwiklabs #GSP918

  6. PHP & MySQL Full Course