Professional Documents
Culture Documents
Create tables of
Department with columns Dept_ID, Dept_Name, where Dept_ID is primary key
Teacher with column Teacher_ID, First_Name, Last_Name, Gender, Salary,
Date_of_Birth, Dept_No, where Teacher_ID is primary key,Dept_no is foreign key and
salary is in decimal type with default value 40000.
CREATE TABLE Department (Dept_ID INTEGER PRIMARY KEY, Dept_Name
VARCHAR(20) NOT NULL);
CREATE TABLE Teacher (Teacher_ID INTEGER PRIMARY KEY, First_Name
VARCHAR(20) NOT NULL,Last_Name VARCHAR(20),Gender CHAR(1),Salary
DECIMAL(10,2) DEFAULT 40000,Date_of_Birth DATE,Dept_No INTEGER,
FOREIGN KEY (Dept_No) REFERENCES Department(Dept_ID));
2. Insert rows in both tables as following