Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please share the file in JSON format Create the following tables in a database named roster. Make sure that your database and tables are named
Please share the file in JSON format
Create the following tables in a database named "roster". Make sure that your database and tables are named exactly as follows including matching case.
DROP TABLE IF EXISTS Member;
DROP TABLE IF EXISTS 'User';
DROP TABLE IF EXISTS Course;
CREATE TABLE 'User'
userid INTEGER NOT NULL AUTOINCREMENT,
name VARCHAR UNIQUE,
PRIMARY KEYuserid
CREATE TABLE Course
courseid INTEGER NOT NULL AUTOINCREMENT,
title VARCHAR UNIQUE,
PRIMARY KEYcourseid
REATE TABLE Member
userid INTEGER,
INTEGER,
role INTEGER,
CONSTRAINT FOREIGN KEY userid REFERENCES 'User' userid
ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT FOREIGN KEY courseid REFERENCES Course courseid
ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY userid courseid
ENGINEInNODB CHARACTER SETut ;
Note that we need to surround User with backquotes ie 'User' because it is a keyword in later versions of MySQL
Course Data
You will normalize the following data each user gets different data and insert the following data items into your database, creating and linking all the foreign keys properly. Encode
instructor with a role of and a learner with a role of
Johnny, si Instructor
Amber, sile Learner
Havin, sile Learner
Kaelum, si Learner Tayyib, si Learner
Rubyn, si Instructor
Alekzander, si Learner
Emelia, si Learner Mikael, si Learner
Oonagh, si Learner
Peregrine, si Instructor
Annabella, si Learner
Tait, si Learner
Tarne, si Learner
You can test to see if your data has been entered properly with the following SQL statement.
You can test to see if your data has been entered properly with the following SQL statement.
SELECT 'User'. name, Course.title, Member. role
FROM "User" JOIN Member JOIN Course
ON 'User', userid Member.userid AND Member.courseid Course.courseid
ORDER BY Course.title, Member.role DESC, 'User'. name
The order of the data and number of rows that comes back from this query should be the same as above. There should be no missing or extra data in your query.
What Turn In
When you have the data all inserted, use phpMyAdmin to Export the data as follows:
Select the database do not select a table within the database
Select the Export Tab
Select "Custom display all possible options"
Select "Save output to a file"
Set the format to JSON
Do not select "pretty print" the output
Leave everything else as default and run the export.
The output will be on a file named "roster.json" that should look like the following:
Export to JSON plugin for PHPMyAdmin
@version
Database 'roster'
roster.Course
courseid:"title":"si
roster.Member
userid:"courseid:"role":"
roster.User
userid: "name":"Areez"
It is a somewhat strange format it is one bit of JSON for each table. You don't need to edit or even look at this file. Simply upload it above.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started