0% found this document useful (0 votes)
12 views3 pages

Bai Lien Ket

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Bai Lien Ket

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignmet: the relationship 2

Bài 1)
1)
Customer(customer_ID,customer_name,customer_address,customer_phone
)
Car(car_ID, license_plate, model, year, customer_ID)
Accident(accident_ID, accident_date, accident_description, car_ID)
Insurance_Policy(policy_ID, policy_start_date, policy_end_date,
customer_ID)
Car_Policy(car_policy_ID, car_ID, policy_ID)
Payment(payment_ID, payment_due_date, payment_received_date, amount,
policy_ID)

2)
A) Quan hệ ba chiều
Student(student_ID, student_name, student_email, student_phone, ...)
Course(_course_ID_, course_name, course_description, ...)
Section(_section_ID_, _course_ID_, semester, year, ...)
Exam(_exam_ID_, exam_name, exam_date, ...)
Marks(_student_ID_, _section_ID_,_exam_ID_, marks)

B) Quan hệ hai chiều


Student(_student_ID_, student_name, student_email, student_phone, ...)
Course(_course_ID_, course_name, course_description,..)
Section(_section_ID_, _course_ID_, semester, year, )

Enrolled_In(_student_ID_, _section_ID_, marks…)

3)
Team(_team_ID_, team_name, coach_name, ... )
Match(_match_ID_, match_date, location, opponent_team_ID, score)
Player(_player_ID_, player_name, position, team_ID, ...)
Participated_In(_player_ID_, _match_ID_, player_score, minutes_played)
Plays_For(_player_ID_, _team_ID_)

4)
Patient(_patient_ID_, patient_name, patient_age, patient_address,
patient_phone, ...)
Doctor(_doctor_ID_, doctor_name, specialty, phone, ...)

Test(_test_ID_, test_name, test_date, result, notes)


Examination(_examination_ID_, examination_date, examination_notes)

Patient_Test(_patient_ID_, _test_ID_)
Patient_Examination(_patient_ID_, _examination_ID_)

5)
Brand(_brand_ID_, brand_name, country, ...)
Model(_model_ID_, model_name, _brand_ID_, ...)
Option(_option_ID_, option_name, description, ...)

Vehicle(_VIN_, _model_ID_, year, price, ...)


Dealer(_dealer_ID_, dealer_name, dealer_address, dealer_phone, ...)
Customer(_customer_ID_, customer_name, customer_email, customer_phone, ...)
Order(_order_ID_, _VIN_, _customer_ID_, _dealer_ID_, order_date, ...)

6)
Customer(_customer_ID_, customer_name, customer_address, customer_phone, ...)
Package(_package_ID_, package_weight, package_dimensions, shipping_date,
delivery_date, status)
Location(_location_ID_, location_type, location_name, location_address, ...)

Tracking(_tracking_ID_, _package_ID_, _location_ID_, timestamp)

2)

employee (employeeID,person name, street, city)

company (companyID, company name, city)

works (employeeID, companyID, salary)

employeeID là khóa chính

companyID là khóa chính

employeeID, companyID là khóa chính

3)
Tên trong trường hợp này có thể sử dụng làm siêu khóa

4) Mỗi instructor đều liên kết với một môn bảng dept_name
VD về lỗi vi phạm ràng buộc khóa ngoại:
Nhìn trg bảng dept_name có môn ‘Physic’ liên kết với 2
instructor có ID 22222 và 33456
Nếu chúng ta xóa ‘Physic’ ra khỏi bảng dept_name mà k xử lí
các bản ghi liên quan sẽ gây ra lỗi ràng buộc khóa ngoại vì
các giảng viên có dept_name = 'Physics' trong bảng instructor
không còn phòng ban tham chiếu, gây ra vi phạm khóa ngoại.

You might also like