lab 9
Competencies:
Creation and Design of MySQL Schema Objects
Design and create normalized databases
Create and drop a database
Create and modify tables using appropriate data types and indexing
Describe and create table constraints enforcing data integrity
Code primary and foreign key constraints
Create and drop indexes
REQUIREMENTS:
Create a new MySQL database for your data
Identify the data types and lengths for each field in your normalized table structure from Lab 10 or you may forward engineer the EER diagram into a table structure.
Create the table structures for each of your tables and save the commands in a .sql script or a text file.
Be sure to include all primary and foreign key constraints.
Add data to each of your tables. You should have 10 rows in each table. You may load the data directly or import it from a file.
Create a query for each of your tables to select all columns and rows of the tables in your database. Save your results as a .sql script.
Click on the View/Complete link at the bottom of this assignment. Attach the two text or script files (one with the structure and one with the data) to the assignment and Submit.
Grading Rubric:
Criteria
Points
Create a MySQL database
5 points
Create the tables
30 points
Create all primary and foreign key constraints
15 points
Add at least 10 rows of data to each table
10 points
Create select queries for each table
15 points
Save the queries and structure commands in one or more sql files and submit.
5 points
Total
80 points
lab 10
LAB 10: USERS AND VIEWS, QUERIES AND BACKUP
Competencies:
Creation and Design of MySQL Schema Objects
Creating and modifying views
List the benefits of using views
Create a view
Alter or drop a view
Select and update database information using a view
Understand user privileges in SQL
Create, rename and drop users
Grant view and revoke user privileges
Query for data
Backup your database
REQUIREMENTS:
Identify the types of users that would be using your database by job type. For example, you might have a sales clerk entering sales information and an hr rep entering personnel information. You should have at least 3 different categories of users for your system.
For each user category determine which tables they would need access to and the type of access they would need (select, update, insert, delete, grant)
Identify at least one view for each user category that would help them easily retrieve the data that they need access to. One of the views should be an updatable view.
Create the views and save the commands in a script file.
For each user category, identify and write 5 queries that they would need to use on a regular basis. You should have 15 queries, including the following:
At least 2 queries that join tables
At least 1 insert query, 1 update query and 1 delete query
At least 1 queries that uses a view
At least 1 query that includes a calculation or an aggregate function.
Save your queries in a .sql file.
Create one user for each role and grant them the privileges they need to do their job. Save the commands in a .sql file
Describe to me the role of each user, the access needed, the views created and why. This may be in a text file or typed into the comments for the assignment.
Perform a full backup of your database using the Export function in the workbench.
Attach all sql queries (views, queries, users and privileges) as well as the database export file to this assignment.
Grading Rubric:
Criteria
Points
Identify 3 categories of users and the access required
5 points
Create 3 views – 1 for each category.
15 points
Create 1 user for each category and grant them access to the tables and views required.
15 points
Describe the roles of each user, access needed, views created and why.
15 points
Create 15 queries, including:
At least 2 queries that join tables
At least 1 insert query, 1 update query and 1 delete query
At least 1 queries that uses a view
At least 1 query that includes a calculation or an aggregate function.
15 points
Full database backup
10 points
Attach a file with the scripts and database export
5 points
Total
80 points