Description
Lab 4: Structured Query Language (SQL)
Due Week 7 and worth 75 points
Refer to the database design crested in Lab 2: Modifying a Database Design to complete this Lab.
Perform the following steps in MySQL:
- Create the tables and relationships from the database design discussed in Lab 2.
- Add at least five (5) records into each table (Note: You must determine the field values).
- Create a query with all fields from the student table, where the student's last name is "Smith".
- Create a query that includes students’ first names, last names, and phone numbers.
- Create a query that includes instructors' first names, last names, and courses they teach.
Include the following screen shots in a Microsoft Word document to show the completion of the steps above:
- Screen shot depicting the tables created within MySQL.
- Screen shots depicting the records added into each table.
- Screen shots depicting the SQL code and the query results from each of the queries created.
Your assignment must follow these formatting requirements:
- Submit the lab as a Microsoft Word document.
- Include a cover page containing the title of the assignment, the student’s name, the professor’s name, the course title, and the date. The cover page is not included in the required assignment page length.
The specific course learning outcomes associated with this assignment are:
- Prepare database design documents using the data definition, data manipulation, and data control language components of the SQL language.
Explanation & Answer
Find the attached doc,Best Regards.
1
Surname
Submitted
By
[Student Name]
To
[Professor Name]
[Course Title]
[Date: ]
2
Surname
Solution:
Screen Shots:
Sol 1.
Table Students:
Table Instructors:
Sol 2.
Inserting Records in Tables
3
Surname
Table Instructors:
4
Surname
5
Surname
Table Students:
6
Surname
7
Surname
Queries:
Sol: 3.
Sol: 4.
Sol: 5.
8
Surname
Work Cited
PNum, C. H. A. R., FName VARCHAR, and LName VARCHAR. "Structured Query
Language (SQL)."
Peña, Jose M. "Structured Query Language (SQL)."
Slazinski, Erick D. "Structured Query Language (SQL)." The Internet Encyclopedia.
Create Table Scripts
create table instructor(
instructorID int primary key,
name varchar(30),
address varchar(100),
mobilenumber varchar(15),
homephonenumber varchar(15),
workphonenumber varchar(15),
personalemailaddress varchar(30),
schoolemailaddress varchar(30),
workemailaddress varchar(30),
gender char(1),
dateofbirth date
);
create table course(
courseID int primary key,
coursename varchar(30),
department varchar(30),
quartersoffered int,
sections int,
instructorID int,
foreign key(instructorID) references instructor(instructorID)
);
create table finalgrades(
gradeID int primary key,
gradename varchar(30),
courseID int,
ramark varchar(100),
foreign key (courseID) references course(courseID)
);
create table Student(
studentID int primary key,
studentname varchar(50),
address varchar(100),
startdate date,
mobilenumber varchar(15),
homephonenumber varchar(15),
workphonenumber varchar(15),
persona...