80 likes | 198 Vues
This document outlines the database schema for an employee management and student event system. The schema depicts relationships between employees and departments, as well as between students and events, utilizing both one-to-one and many-to-one relationships. The employee table includes employee ID, name, and department ID, while the department table includes department ID and post. The student table features student ID, name, and class, and is connected to event details through a new admission table for better data organization.
E N D
EMPLOYEE (empid, name) DEPARTMENT(depid, post, empid ) Database Schema (1:1 Relationship) Empid depid manages EMPOLYEE Department 1 1 name post
Empid depid manages EMPOLYEE Department 1 1 name EMPLOYEE(empid, name, depid) DEPARTMENR(depid, post) post Database Schema (1:1 Relationship) or • NO new table is created. • FK can be added to either table.
EMPLOYEE (empid, name, depid ) DEPARTMENT(depid, post,) Database Schema (M:1 Relationship) Empid depid Works in EMPOLYEE Department M 1 name post
Empid depid Works in EMPOLYEE Department M 1 name post Database Schema (M:1 Relationship) EMPLOYEE (empid, name, depid ) DEPARTMENT(depid, post,) • FK should be added to “many” side. • Doesn’t matter for cardinalities.
sid date evid admission Student event M N sname class schoolyear grade evname Database Schema (M:N Relationship) STUDENT (sid, sname, class, classno) EVENT (evid, evname, grade, gender) How about admission?
sid date evid admission Student event M N sname class schoolyear grade evname Database Schema (M:N Relationship) STUDENT (sid, sname, class, classno) EVENT (evid, evname, grade, gender) • A new table is needed. • FK(s) should be placed in that new table. ADMISSION (sid, evid, date, schooyear)
Ex. Transform the E-R diagram into database schema standard_cost vid unit_cost mid supply VENDOR RAW_MATERIAL M N M vendor_name manufacture pid product_desc N PRODUCT unit_price
Standard_cost vid unit_cost mid supply VENDOR RAW_MATERIAL M N M vendor_name manufacture Pid VENDOR (vid, vendor_name) RAW_MATERIAL (mid, standard_code) PRODUCT (pid, product_desc, unit_price) SUPPLY (vid, mid, unit_cost) MANUFACTURE (pid, mid) product_desc PRODUCT N Unit_price