إنشاء جداول وبينهم علاقة واحد لواحد One to One Relationship
Entity Relationship Model (ERD)
Relational Model (Mapping)
SQL (Create Tables)
CREATE TABLE IF NOT EXISTS EMPLOYEE
(
SSN CHAR(4) PRIMARY KEY ,
Name VARCHAR(60) NOT NULL ,
BirthDate Date ,
Salary FLOAT(6,2)
);
CREATE TABLE
DEPARTMENT
(
Dept_No CHAR(2) ,
Dept_Name VARCHAR(50) NOT NULL ,
Manager CHAR(4) UNIQUE
,
Primary Key(Dept_No) ,
Foreign Key (Manager) REFERENCES EMPLOYEE(SSN) );