CS-315 – Assignment III
(10 points)
After installing MySQL (using the steps posted on D2L under Install_MySQL.pdf document), use MySQL Workbench (search for it from the start menu of Windows OS or application menu of Mac OS).
This is the relational DBMS that you will use for this assignment.
Create a new database (named MyUniversity) then use it for the tasks listed in the next steps, using the
following commands:
Command Describtion
SHOW DATABASES; List all the available/created databases
CREATE DATABASE databasename; Create a new database named databasename
DROP DATABASE databasename; Delete a database named databasename
USE databasename; Use the database (databasename) to execute more queries
The creation (using the CREATE command) should be done once, and the USE command should be triggered every time you re-open MySQL workbench. You cannot perform any query on your database before the USE command.
Task Description: consider the following relations for a university:
Student (sid: integer, sname: string, GPA: real, dateOfBirth: date)
Department (did: integer, dname: string, capacity: integer)
Course (cid: integer, cname: string, credit: integer)
Enroll (studentID: integer, courseID: integer, departmentID: integer, enrollmentDate: date)
studentID, courseID, and departmentID in Enroll are foreign keys referencing the primary keys of the
student, course, and department relations, respectively.
Task1 (2 points): Using SQL, create these relations under the MyUniversity database you created. Place
the constraints (e.g., default values) you find appropriate.
Task2 (4 points): Using SQL, insert (random but meaningful) data records in the above tables.
Create at least 3 different courses, including OS, DB, Marketing, and Networks courses.
Create 2 departments, Computer Science department and Business department.
Add at least 8 students (divided on the two departments 4 for each department), and at least two
different enrollments for each student (each student is registered for two different courses). The
enrollments should be between January2020 and December2020.
Task3 (4 points 1 point/query): Using SQL, develop and execute the following queries:
1- For each student with GPA between 2.5 (included) and 3.5 (included), display the students name
and id.
2- Display unique enrollments (by students name and Courses name) of June2020 for students from
the Computer Science department.
3- Display students, by name and date of birth, sorted by GPA in descending order.
4- Display the students, by name and GPA, enrolled in the OS course sorted by GPA in descending
order then students names in Ascending order.
Submission:
1. For task 1, take clear screenshots to the queries you developed to create the tables.
2. For task 2, after inserting the records, take a clear screenshot for the content of each table as follows:
SELECT *
FROM theTableName;
No need to take screenshot to the developed insert queries.
3. For task 3, for each query, take a clear screenshot for both the query you developed as well as the
output.
4. This is an individual assignment — Cheating/plagiarism will be checked and will receive zero.
5. Submit ONE PDF file directly to the folder titled Assignment 3 under the D2L Assignments tab (other
formats will not be accepted). Dont submit .zip, .ppt, .pptx, .doc, .docx file.
6. The assignment is due 10:00pm October 28th. You can submit your assignment, within 24 hours after
this due date, to be graded out of 50% of the assignments grade. After this grace period your late
submission will not be accepted.
CS-315 – Assignment III Database
Our Service Charter
1. Professional & Expert Writers: Homework Discussion only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.
2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.
3. Plagiarism-Free Papers: All papers provided by Homework Discussion are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.
4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Homework Discussion is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.
5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.
6. 24/7 Customer Support: At Homework Discussion, we have put in place a team of experts who answer to all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.