Question
Case 2 Assume you have set up a relational database using only the 2 tables shown below. Student Hall Hall ID Name Age Address Hall_ID
Case 2
Assume you have set up a relational database using only the 2 tables shown below.
Student Hall
Hall ID Name Age Address Hall_ID Hall_ID Hall Name Tutor
001 CHEN Biming 17 Chongqing 01 01 Zhuo Ya Dr. Hanks
002 LIU Nuan 18 Tianjin 02 02 Huan Ya Dr. Chen
003 ZHANG Xiu 21 Wuhan 03 03 Wen Ya Dr. Wang
004 SONG Jian 19 Chengdu 01
a) What are the two entities for the relational database? (4 Marks)
b) What is the primary key and foreign key in the table STUDENT? (4 Marks)
c) Please draw the entity-relationship diagram to illustrate the relationship(s) among the entities in the above database. (4 Marks)
d) What are the query results that would be displayed if you wrote this SQL statement: (4 Marks)
e) Please write down the SQL statement: o To find the student who lived in Hall 1 and display their information, including their ID, Name, Age, and address. (2 marks) o To insert a new student record where ID is 006, Name is Chen Qing, Age is 18, and Address is Changsha and assign her to Hall 3. (2 marks).
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