Simple Tables and Relationships
Re-implent the AppSheet Database in MariaDB/MySQL
Follow the in-class instructions to re-implement the AppSheet database from the previous lab in MariaDB/MySQL.
Insert 5 sample records into the table.
Course Table
Using phpMyAdmin create a new course table in your nXXXXXXX_cps146_a2 database.
- Select your nXXXXXXX_cps146_a2 database.
- Name the new table "Course".
- Set number of columns to 4.
- Click on the "Go" button.
- For the subject code column:
- For "Name", enter "SubjectCode".
- For "Type", choose "ENUM".
- Under "Length/Values", click the "Edit ENUM/SET values" link.
- Enter "CPS" and "DGL"; delete the two blanks; and click the "Go" button.
- For the "Index", choose "PRIMARY"; click the "Go" button.
- For the course number column:
- For "Name", enter "CourseNumber".
- For "Type", choose "INT".
- For "Length/Values", enter "3".
- For the "Index", choose "PRIMARY"; click the "Go" button.
- For the title column:
- For "Name", enter "Title".
- For "Type", choose "VARCHAR".
- For "Length/Values", enter "50".
- For the credits column:
- For "Name", enter "Credits".
- For "Type", choose "INT".
- For "Length/Values", enter "1".
- Click on the "Save" button at the far bottom right of the form.
- Go to "Insert" tab.
- Fill out some sample data in the "Value" column of the form and use the "Go" button to insert the new record.
- Repeat until you have 5 records in the table.
- Try adding a record with a duplicate SubjectCode/CourseNumber and convince yourself this does not work.
Event Table
Create an "Event" table. You will need to record the building which is one of "KMX", "DIS", "RAV", or "TYE". You will also need the room number which is a 3 digit number. Each event will also have a title and a starting and ending time.
Set a natural primary key that will at least prevent multiple events being scheduled to start in the same room at the same time. Don't worry about other overlapping for now.
Enter 5 sample records into your new table.
Relationships
In-class
Follow the in-class instructions to implement the following tables and relationships.
High-level model:
Implementation (table-level) model:
On Your Own
Create the tables and some sample data (at least 5 records in each table) for a hair salon based on the following high-level model.
Be sure to create the appropriate primary and foreign keys. Also, be sure to add any additional attributes to the tables that seem relevant.