-
Notifications
You must be signed in to change notification settings - Fork 0
/
databaseTable.txt
23 lines (12 loc) · 2.36 KB
/
databaseTable.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
CREATE TABLE IF NOT EXISTS DEPARTMENT_MASTER (Dept_Id VARCHAR PRIMARY KEY, Dept_Name VARCHAR);
CREATE TABLE IF NOT EXISTS REGION_MASTER (Region_Id VARCHAR PRIMARY KEY, Region_Name TEXT, Region_Status INTEGER);
CREATE TABLE IF NOT EXISTS COUNTRY_MASTER (Country_Id VARCHAR PRIMARY KEY, Country_Name text);
CREATE TABLE IF NOT EXISTS RELATION_MASTER (Relation_Id VARCHAR PRIMARY KEY, Relation_Desc VARCHAR);
CREATE TABLE IF NOT EXISTS BANK_MASTER (Bank_Id VARCHAR PRIMARY KEY, Bank_Name TEXT);
CREATE TABLE IF NOT EXISTS EDUCATION_MASTER (Education_Id VARCHAR PRIMARY KEY, Education_Desc VARCHAR);
CREATE TABLE IF NOT EXISTS DESIGNATION_MASTER (Designation_Id VARCHAR PRIMARY KEY, Designation_Desc VARCHAR);
CREATE TABLE IF NOT EXISTS COMPANY_LOCATION (Location_Id VARCHAR PRIMARY KEY, Region_Id VARCHAR, Country_Id VARCHAR, FOREIGN KEY(Region_Id) REFERENCES REGION_MASTER(Region_Id), FOREIGN KEY(Country_Id) REFERENCES COUNTRY_MASTER(Country_Id) );
CREATE TABLE IF NOT EXISTS EMPLOYEE (Emp_Id VARCHAR PRIMARY KEY, Emp_Name TEXT, Emp_Dept_Id VARCHAR, Emp_Sex INTEGER, Emp_Maritial_Status INTEGER, Emp_Join_Date DATE, Emp_Birth_Date DATE DATE, Emp_Age INTEGER, Emp_Education_Id VARCHAR, Emp_Designation_Id VARCHAR, Emp_Salary NUMBER(10,2), Emp_Location_Id VARCHAR, Emp_Active_Status INTEGER, FOREIGN KEY(Emp_Dept_Id) REFERENCES DEPARTMENT_MASTER(Dept_Id), FOREIGN KEY(Emp_Education_Id) REFERENCES EDUCATION_MASTER(Education_Id), FOREIGN KEY(Emp_Designation_Id) REFERENCES DESIGNATION_MASTER(Designation_Id), FOREIGN KEY(Emp_Location_ID) REFERENCES COMPANY_LOCATION(Location_Id) );
CREATE TABLE IF NOT EXISTS ACCOUNT_DETAILS (Emp_Id VARCHAR, Account_No INTEGER(10), Bank_Id VARCHAR, Account_Type INTEGER, PRIMARY KEY(Emp_Id, Account_No), FOREIGN KEY(Emp_ID) REFERENCES EMPLOYEE(Emp_Id), FOREIGN KEY(Bank_Id) REFERENCES BANK_MASTER(Bank_Id) );
CREATE TABLE IF NOT EXISTS FAMILY_DETAILS (Family_Id VARCHAR, Emp_Id VARCHAR, Emp_Relation_Id VARCHAR, Relation_Name TEXT, Relation_Age INTEGER, Nominee INTEGE, PRIMARY KEY(Family_Id, Emp_Id), FOREIGN KEY(Emp_Id) REFERENCES EMPLOYEE(Emp_Id), FOREIGN KEY(Emp_Relation_Id) REFERENCES RELATION_MASTER(Relation_Id) );
CREATE TABLE IF NOT EXISTS ADDRESS (Address_Id VARCHAR, Emp_Id VARCHAR, Address1 VARCHAR, Address2 VARCHAR, Tel_No VARCHAR, Address_Type INTEGER, PRIMARY KEY(Address_Id, Emp_Id), FOREIGN KEY(Emp_Id) REFERENCES EMPLOYEE(Emp_Id) );