Suppose that the following are true: - all id column are primary keys in whichever table they are - the dept_id in course table is foreign key that is referencing the id column in the department table - the foreign keys stud_type_id, stud_cat_id in the student table are referencing the id columns in the student_type and student_category tables respectively. the coursecode and stud_id columns in the registration table are foreign keys in the course and student tables respectively. 1. Design an Entity Relationship Diagram for the system above. 2. Write query that would return the names and contacts of all Local students. 3. Write a query that would return names, contact and locations of all departments that has a location text with Ave 3 as part of it. [hint: use the LIKE clause with "_" or "%"]

A Guide to SQL
9th Edition
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Philip J. Pratt
Chapter2: Database Design Fundamentals
Section: Chapter Questions
Problem 15RQ
icon
Related questions
Question
Suppose that the following are true:
all id column are primary keys in whichever table they are
the dept_id in course table is foreign key that is referencing the id column in the department table
the foreign keys stud_type_id, stud_cat_id in the student table are referencing the id columns
in the student_type and student_category tables respectively.
the coursecode and stud_id columns in the registration table are foreign keys in the course
and student tables respectively.
1. Design an Entity Relationship Diagram for the system above.
2. Write query that would return the names and contacts of all Local students.
3. Write a query that would return names, contact and locations of all departments that has a
location text with Ave 3 as part of it. [hint: use the LIKE clause with "_" or "%"]
4. What would be the result returned for the following query:
SELECT first_name, last_name, student_type.name,
student_category.name
FROM student, student_type, student_category
WHERE stud_type_id = student_type.id
AND stud_cat_id = student_category.id
AND student_type.name = "Sandwich";
5. Write a query that would present the first and last names, student type and category of all
distance students.
6. What would be the result of the following query:
SELECT student.id, first_name, last_name, contact,
registration_type.name, course.code
FROM student, registration, registration_type, course
WHERE student.id = stud id
AND reg_type_id = registration_type.id
AND registration_type.name = "re-sit"
AND course_code = course.code;
7. Write a query that would return the names and date of birth of all students that have
registration_type of Normal.
8. Write a query that would return the first names, last names, contacts and student types of all
sandwich students.
9. What would be the results of this query:
SELECT course_code, department.name department
FROM course, registration, department
WHERE course.dept_id = department.id
AND course.code=course_code
GROUP BY course_code
ORDER BY course_code desc;
10. Write a query that would return the departments names and the number of courses registered
from them.
Transcribed Image Text:Suppose that the following are true: all id column are primary keys in whichever table they are the dept_id in course table is foreign key that is referencing the id column in the department table the foreign keys stud_type_id, stud_cat_id in the student table are referencing the id columns in the student_type and student_category tables respectively. the coursecode and stud_id columns in the registration table are foreign keys in the course and student tables respectively. 1. Design an Entity Relationship Diagram for the system above. 2. Write query that would return the names and contacts of all Local students. 3. Write a query that would return names, contact and locations of all departments that has a location text with Ave 3 as part of it. [hint: use the LIKE clause with "_" or "%"] 4. What would be the result returned for the following query: SELECT first_name, last_name, student_type.name, student_category.name FROM student, student_type, student_category WHERE stud_type_id = student_type.id AND stud_cat_id = student_category.id AND student_type.name = "Sandwich"; 5. Write a query that would present the first and last names, student type and category of all distance students. 6. What would be the result of the following query: SELECT student.id, first_name, last_name, contact, registration_type.name, course.code FROM student, registration, registration_type, course WHERE student.id = stud id AND reg_type_id = registration_type.id AND registration_type.name = "re-sit" AND course_code = course.code; 7. Write a query that would return the names and date of birth of all students that have registration_type of Normal. 8. Write a query that would return the first names, last names, contacts and student types of all sandwich students. 9. What would be the results of this query: SELECT course_code, department.name department FROM course, registration, department WHERE course.dept_id = department.id AND course.code=course_code GROUP BY course_code ORDER BY course_code desc; 10. Write a query that would return the departments names and the number of courses registered from them.
Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Intermediate SQL concepts
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning