You are on page 1of 9

Lab 1.

2 is to insert the sample database into the MySQL you successfully installed in your
laptop.

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 database. It contains typical business data such as customers, products, sales orders,
sales order line items, etc.
We use this sample database in our MySQL tutorials to demonstrate many MySQL features from
simple queries to complex stored procedures.

After uncompressing the mysqlsampledatabase.zip file (download from Google Classroom), you can
load the sample database into MySQL database server by following the below steps.

How to Load Sample Database into MySQL Database


Server
Summary: in this tutorial, you will learn how to load the MySQL sample database into MySQL
database server using MySQL Workbench. After the tutorial, you will have
classicmodels sample database loaded into MySQL server for practicing and learning
MySQL.

First, download the classicmodels database from the MySQL sample database section

Second, unzip the downloaded file into a temporary folder named temp as follows:

Third, launch MySQL Workbench from the Program Files and follow the steps below:
Launch MySQL Workbench
Launch MySQL Workbench from the Program files

New Connection
Click New Connection to add a new database connection
Setup New Connection
Enter the connection name e.g., local and click OK button

Connection
Click the local database connection to connect to MySQL database server
Connect to MySQL Server
Enter the password for the root account and click OK

MySQL Workbench
MySQL Workbench is open
Open SQL Script
From the File menu, choose "Open SQL Script..."
Choose SQL Script File
Choose the Sample Database File e.g., c:\temp\mysqlsampledatabase.txt

Execute SQL Script


Click execute button from the toolbar to execute the SQL script.

Refresh All
Right click inside the Schema panel and click Refresh All to update the panel

classicmodels database
The classimodels datababase is loaded successfully into MySQL database server
Test the database by typing the below sql codes in the command line prompt.

1 USE classicmodels;
2 SELECT * FROM customers;

Basically, those statements switch the current database to classicmodels and query data from
the customers table. If you see the customers data returned, you have successfully imported
the sample database into the MySQL database server.

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 line categories.
● Orders: stores sales orders placed by customers.
● OrderDetails: stores sales order line items for each sales order.
● Payments: stores payments made by customers based on their accounts.
● Employees: stores all employee information as well as the organization structure such
as who reports to whom.
● Offices: stores sales office data.
In this lab, we have shown you step by step how to load the MySQL sample database named
classicmodels into MySQL database server using MySQL Workbench.

Print screen the important steps as shown to show you had did the installation accordingly.

You might also like