Docsity

WGU c170 Database Applications Labs With complete Solution, Exams of Database Programming

Toggle sidebar
bg1
•
Normalizing a dataset
•
Creating an E-R Diagram
•
Writing CREATE TABLE statements - establishing primary and foreign keys
•
Establishing relationships between entities with the FOREIGN KEY REFERENCE statement
•
INSERTING data into tables (including multi-row INSERT statements)
•
Using the CONCAT function
•
Using aliases for table names
LAB 3 - CREATE MYSQL CONNECTION
You are required to take the following steps to accomplish the task:
1. On the MySQL Workbench Home window, click the [+] icon next to MySQL Connections.
This opens the Setup New Connection wizard.
2. Define the Connection Name value as MyFirstConnection.
3. Ensure that Connection Method is set as Standard (TCP/IP).
4. Click the OK button to create the new MySQL connection.
LAB 4 - CREATE DB ‘NAME’
You are required to take the following steps to accomplish the task:
1. Go to the Database menu.
2. Select Connect to Database.
3. Ensure that Stored Connection is set as Myconnection.
4. Ensure that Connection Method is set as Standard (TCP/IP).
5. Click the OK button.
6. Write the following query on the SQL Editor window:
CREATE DATABASE PizzaOrderingDB;
7. Click the Execute button on the top of the SQL Editor window to execute the query.
LAB 5 – CREATE A NEW MODEL (SCHEMA) Physical Schema rename to pizzaorderingdb
pf3
pf4
pf5
pf8

Partial preview of the text

Download WGU c170 Database Applications Labs With complete Solution and more Exams Database Programming in PDF only on Docsity!

  • Normalizing a dataset
  • Creating an E-R Diagram
  • Writing CREATE TABLE statements - establishing primary and foreign keys
  • Establishing relationships between entities with the FOREIGN KEY REFERENCE statement
  • INSERTING data into tables (including multi-row INSERT statements)
  • Using the CONCAT function
  • Using aliases for table names LAB 3 - CREATE MYSQL CONNECTION You are required to take the following steps to accomplish the task:
  1. On the MySQL Workbench Home window, click the [+] icon next to MySQL Connections. This opens the Setup New Connection wizard.
  2. Define the Connection Name value as MyFirstConnection.
  3. Ensure that Connection Method is set as Standard (TCP/IP).
  4. Click the OK button to create the new MySQL connection. LAB 4 - CREATE DB ‘NAME’ You are required to take the following steps to accomplish the task:
  5. Go to the Database menu.
  6. Select Connect to Database.
  7. Ensure that Stored Connection is set as Myconnection.
  8. Ensure that Connection Method is set as Standard (TCP/IP).
  9. Click the OK button.
  10. Write the following query on the SQL Editor window: CREATE DATABASE PizzaOrderingDB;
  11. Click the Execute button on the top of the SQL Editor window to execute the query. LAB 5 – CREATE A NEW MODEL (SCHEMA) Physical Schema rename to pizzaorderingdb

CREATE TABLE Pizza ( PizzaID INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY, PizzaName VARCHAR( 50 ) NOT NULL, You are required to take the following steps to accomplish the task:

  1. Click File > New Model. A model can contain multiple schemata. Note that when you create a new model, it contains the mydb schema by default.
  2. On the Physical Schemas toolbar, click the Add button to add a new schema.
  3. In the tabsheet, change the name of the schema to pizzaorderingdb. Ensure that this change is reflected on the Physical Schemata tab. LAB 6 – CREATE AN ER DIAGRAM You are required to take the following steps to accomplish the task:
  4. Go to the File menu.
  5. Select the Open Model option.
  6. Choose model and click the Open button.
  7. Go to the Model menu.
  8. Select the Create Diagram from Catalog Objects option.
  9. Select 1:n Non-Identifying relationship.
  10. Select the PizzaOrder table and then select the Customer table to add a foreign key between them.
  11. Select 1:n Non-Identifying relationship.
  12. Select the PizzaOrder table and then select the Pizza table to add a foreign key between them. LAB 7 – CREATE TABLES IN MYSQL WORKBENCH ENVIRONMENT You are required to take the following steps to accomplish the task:
  13. Go to the Database menu.
  14. Select Connect to Database.
  15. Ensure that Stored Connection is set as Myconnection.
  16. Ensure that Connection Method is set as Standard (TCP/IP).
  17. Click the OK button.
  18. Write the following query on the SQL Editor window:

UPDATE CustomerPizzaOrder SET OrderQty = 10 WHERE PizzaOrderID = 2 ;

  1. Click the Execute button on the top of the SQL Editor window to execute the query. LAB 10 – UPDATE DATA IN A TABLE IN MYSQL WORKBENCH ENVIRONMENT You are required to take the following steps to accomplish the task:
  2. Go to the Database menu.
  3. Select Connect to Database.
  4. Ensure that Stored Connection is set as Myconnection.
  5. Ensure that Connection Method is set as Standard (TCP/IP).
  6. Click the OK button.
  7. Write the following query on the SQL Editor window:
  8. Click the Execute button on the top of the SQL Editor window to execute the query. LAB 11 – DELETE DATA IN A TABLE IN MYSQL WORKBENCH ENVIRONMENT You are required to take the following steps to accomplish the task:
  9. Go to the Database menu.
  10. Select Connect to Database. INSERT INTO Customer (LastName, FirstName, Street, Apt, City, State, Zip, HomePhone, MobilePhone, OtherPhone) VALUES ('Pitt', 'Brad', '1 Paris Lane', NULL, 'Hollywood', 'CA', '11111', '111- 111 - 1111', '111- 111 - 1112', '111- 111 - 1113'); INSERT INTO Pizza (PizzaName, PizzaDescription, PizzaSize, PizzaPrice, PizzaPhotoID) VALUES ('Meat Lovers','Pizza with three meats: pepperoni, sausage, and bacon.','Small',8.00,'www.pizzaphotos.com/pizza1S.jpg'); INSERT INTO CustomerPizzaOrder (CustomerID, PizzaID, PizzaOrderTimestamp, OrderQty, SpecialNotes) VALUES ( 1 , 2 , '2014- 01 - 01 16:00:00', 3 , 'Please include plates and napkins');

DELETE FROM CustomerPizzaOrder WHERE PizzaOrderID = 2 ; Select * from Customer; Select * from Pizza; Select * from CustomerPizzaOrder;

  1. Ensure that Stored Connection is set as Myconnection.
  2. Ensure that Connection Method is set as Standard (TCP/IP).
  3. Click the OK button.
  4. Write the following query on the SQL Editor window:
  5. Click the Execute button on the top of the SQL Editor window to execute the query. LAB 12 – BUILD A SIMPLE QUERY IN MYSQL WORKBENCH ENVIRONMENT You are required to take the following steps to accomplish the task:
  6. Go to the Database menu.
  7. Select Connect to Database.
  8. Ensure that Stored Connection is set as Myconnection.
  9. Ensure that Connection Method is set as Standard (TCP/IP).
  10. Click the OK button.
  11. Write the following query on the SQL Editor window:
  12. Click the Execute button on the top of the SQL Editor window to execute the query. LAB 13 – BUILD A COMPLEX QUERY IN MYSQL WORKBENCH ENVIRONMENT

You are required to take the following steps to accomplish the task:

1. Go to the Database menu.

2. Select Connect to Database.

3. Ensure that Stored Connection is set as Myconnection.

4. Ensure that Connection Method is set as Standard (TCP/IP).

5. Click the OK button.

6. Write the following query on the SQL Editor window:

  1. Select Connect to Database.
  2. Ensure that Stored Connection is set as Myconnection.
  3. Ensure that Connection Method is set as Standard (TCP/IP).
  4. Click the OK button.
  5. Write the following query on the SQL Editor window: CREATE INDEX I_PizzaName ON Pizza (PizzaName);
  6. Click the Execute button on the top of the SQL Editor window to execute the query.

LAB 16 – NORMALIZING THE UNNORMALIZED MODEL TO 1 st^ NORMAL FORM

The following image shows the attribute in 1 st^ normal form : Lesson: Normalization Objective: The Normalization Process

LAB 17 – NORMALIZING FROM 1 ST^ NORMAL FORM TO 2 ND^ NORMAL FORM

The following image shows the attribute in 2 nd^ normal form : Lesson: Normalization Objective: The Normalization Process

LAB 18 –