LUCESM
LUCESM
In this exercise, create your own database and name it with your last name, e.g., delacruz_db.
You will create five tables, each with a relationship to another table through a foreign key
column. Follow the instructions for each item below and perform the tasks accordingly. After
executing the SQL statements and verifying the correct output, take a screenshot showing the
name of your database and paste it below the sentence you just followed and performed. Name
your file with your last name followed by the first letter of your first name, e.g., DelaCruzJ, and
submit your work via the Google Drive link provided. The deadline is this Friday, and failure to
submit the exercise by Friday will result in a grade of 0.
When creating each table, include the last two necessary columns for monitoring record
purposes.
1. Create the first table named tbl_teachers with the following columns:
teacher_id
first_name
middle_name
last_name
suffix_name
2. Create the second table named tbl_subjects with the following columns:
subject_id
name
teacher_id (foreign key referencing tbl_teachers.teacher_id)
3. Create the third table named tbl_sections with the following columns:
section_id
name
4. Create the fourth table named tbl_students with the following columns:
student_id
first_name
middle_name
last_name
suffix_name
section_id (foreign key referencing tbl_sections.section_id)
5. Create the fifth table named tbl_classes with the following columns:
class_id
student_id (foreign key referencing tbl_students.student_id)
subject_id (foreign key referencing tbl_subjects.subject_id)
6. In tbl_teachers, insert at least three of your teachers from this 1st semester using a stored
procedure.
7. In tbl_subjects, insert all current subjects handled by the three teachers you selected and
added to tbl_teachers this 1st semester using a stored procedure.
8. In tbl_sections, insert all 3rd-year sections for this 1st semester using a stored procedure.
9. In tbl_students, insert three students from each section. For example, 3 from BSCS 3A, 3
from BSIT 3A, 3 from BSIT 3B, 3 from BSIT 3C, and 3 from BSIT 3D using a stored
procedure.
10. In tbl_classes, insert all students from tbl_students along with their current subjects from
tbl_subjects using a stored procedure.
11. Load records from different tables by combining them using INNER JOIN with the
following selected columns:
a. The full name of students, created by combining the first_name, middle_name,
last_name, and suffix_name columns using CONCAT.
b. The section name from tbl_sections.
c. The subject name from tbl_subjects.
d. The full name of the teacher, created in the same way as the students' full name.
e. Use tbl_classes as Table 1 before joining other tables. Perform this using a stored
procedure.
12. Load records from different tables by combining them using LEFT JOIN with the same
selected columns as in number 11. Use tbl_classes as Table 1 before joining other tables.
Perform this using a stored procedure.
13. Load records from different tables by combining them using RIGHT JOIN with the same
selected columns as in number 11. Use tbl_students as Table 1 before joining other
tables. Perform this using a stored procedure.
14. Load records from different tables by combining them using LEFT JOIN with the same
selected columns as in number 11. Use tbl_classes as Table 1 before joining other tables.
Filter the results to display only three students from your section. Perform this using a
stored procedure.
15. Load records from different tables by combining them using LEFT JOIN with the same
selected columns as in number 11. Use tbl_classes as Table 1 before joining other tables.
Filter the results so that the full names of students are sorted in ascending order. Perform
this using a stored procedure.
If you have any concerns or clarifications about the instructions or submitting your work, you
may message me anytime.