0% found this document useful (0 votes)
152 views

Lab B - Installation and Test of Sakila Database

The document describes installing and testing the Sakila sample database for MySQL. It involves downloading the Sakila database files from the MySQL website, importing the schema and data files using the SOURCE command, and performing various tests on the new database like viewing tables, querying data, and inserting new records.

Uploaded by

marlonb0007
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
152 views

Lab B - Installation and Test of Sakila Database

The document describes installing and testing the Sakila sample database for MySQL. It involves downloading the Sakila database files from the MySQL website, importing the schema and data files using the SOURCE command, and performing various tests on the new database like viewing tables, querying data, and inserting new records.

Uploaded by

marlonb0007
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

COURSE: MySQL Server Administration

LAB B – INSTALLATION AND TEST OF SAKILA DATABASE

Lab B – Installation and Test of Sakila Database.


Objective: Deploy and Test a new installation for Sakila Database of MySQL
Server.

In this lab, you perform the following tasks:

1. Download a Sakila Database from MySQL website.


2. Install a Sakila Database in your MySQL Server.
3. Take a test about Sakila Database.
4. Discussion.

Task 1: Download a Sakila Database from MySQL website.


The Sakila sample database is available from https://dev.mysql.com/doc/index-other.html. A
downloadable archive is available in compressed tar file or Zip format. The archive contains three files:
sakila-schema.sql, sakila-data.sql, and sakila.mwb.

-Open your Chrome Browser in WS2012 Server Node, then Type:

https://dev.mysql.com/doc/index-other.html

Page 1 of 12
COURSE: MySQL Server Administration
LAB B – INSTALLATION AND TEST OF SAKILA DATABASE

-Move the cursor behind the page and click on “Sakila database Zip distribution”.

-You will see that the package download to your Windows Server Node.

Page 2 of 12
COURSE: MySQL Server Administration
LAB B – INSTALLATION AND TEST OF SAKILA DATABASE

-Open your download Folder and locate the “Sakila-db.zip” file.

-Right Click over the zip file and Extract All the installation archive to a temporary location, when you
unpack the archive, it creates a directory named sakila-db that contains the sakila-schema.sql and sakila-
data.sql files.

Page 3 of 12
COURSE: MySQL Server Administration
LAB B – INSTALLATION AND TEST OF SAKILA DATABASE

-Browse the folder Downloads/Sakila-db and open it.

Page 4 of 12
COURSE: MySQL Server Administration
LAB B – INSTALLATION AND TEST OF SAKILA DATABASE

IMPORTANT:

The sakila-schema.sql file contains all the CREATE statements required to create the structure of the
Sakila database including tables, views, stored procedures, and triggers.

The sakila-data.sql file contains the INSERT statements required to populate the structure created by
the sakila-schema.sql file, along with definitions for triggers that must be created after the initial data
load.

The sakila.mwb file is a MySQL Workbench data model that you can open within MySQL Workbench to
examine the database structure. For more information, see MySQL Workbench.

-Copy the folder “Sakila-db” to Drive E:/>

-Connect to the MySQL server using the Windows Server command-line session with the following
command: mysql -u root -p

And provide the Administrator password (Pa$$w0rd), then press Enter.

Page 5 of 12
COURSE: MySQL Server Administration
LAB B – INSTALLATION AND TEST OF SAKILA DATABASE

-Then you will run the script to create an Schema, type the command and Press Enter:

SOURCE E:\sakila-db\sakila-schema.sql

-You will see a very Rows affected and Database Changed Message.

-Then you will run the script to create the data in Database, type the command and Press Enter:

SOURCE E:\sakila-db\sakila-data.sql

Page 6 of 12
COURSE: MySQL Server Administration
LAB B – INSTALLATION AND TEST OF SAKILA DATABASE

-You will see a very Rows affected and Database Changed Message.

Task 3: Take a test about Sakila Database.


-You will select the new Database, type the Command and Press Enter:

USE sakila

-You receive a message that “Database changed”

Page 7 of 12
COURSE: MySQL Server Administration
LAB B – INSTALLATION AND TEST OF SAKILA DATABASE

--You will SHOW tables of the new Database, type the Command and Press Enter:

SHOW TABLES

-You will see the List of all Tables in Database.

Page 8 of 12
COURSE: MySQL Server Administration
LAB B – INSTALLATION AND TEST OF SAKILA DATABASE

-Review the Row in Set value about Address Table, Type the command and Press Enter:

SELECT COUNT(*) FROM ADDRESS;

-Review the content of Address Table, Type the command and Press Enter:

SELECT * FROM ADDRESS;

-You will see all the content of any Register.

Page 9 of 12
COURSE: MySQL Server Administration
LAB B – INSTALLATION AND TEST OF SAKILA DATABASE

-Review the Specific value inside the Address Table, Type the command and Press Enter:

SELECT * FROM ADDRESS WHERE address_id=500;

You will see only the values for a register with address_id=500.

-Insert a new row set into rental Table, Type the next Command and press Enter:
INSERT INTO rental(rental_date, inventory_id, customer_id, staff_id) VALUES(NOW(), 10, 3, 1);

-Then Check the value (review the Date of NOW 2019), Type the next Command and press Enter:
SELECT * FROM rental WHERE inventory_id=10;

Page 10 of 12
COURSE: MySQL Server Administration
LAB B – INSTALLATION AND TEST OF SAKILA DATABASE

-Use a process inside Database to calculate the Balance for a customer, Type the next command and
press Enter:

SELECT @balance:=get_customer_balance(3,NOW());

-Now change a row set with this value calculate in the @balance, Type the next Command and Press
Enter:
INSERT INTO payment (customer_id, staff_id, rental_id, amount, payment_date)
VALUES(3,1,LAST_INSERT_ID(), @balance, NOW());

Page 11 of 12
COURSE: MySQL Server Administration
LAB B – INSTALLATION AND TEST OF SAKILA DATABASE

Task 4: Discussion.
1. What is the command you use to Select a Database?

2. What sentence you will use to deploy an Database Script?

3. What sentence you will use to access to your MySQL Server?

4. What is the Link that you can use for download DataBase Examples for MySQL?

5. What types of Operations you can do in a MySQL Command Line Session?

Page 12 of 12

You might also like