Sie sind auf Seite 1von 3

Create the below tables and insert the given data PRIMARY KEY

FOREIGN KEY WITH REFERENCES

EMPLOYEE ENAME ESRNO BDATE ADDRESS SEX SALARY MGRSRNO DNO

DEPARTMENT DNAME DNUMBER MGRSRNO MGRSTARTD

DEPT_LOCATIONS DNUMBER DLOCATION

PROJECT PNAME PNUMBER PLOCATION DNUM

WORKS_ON ESRNO PNO HOURS


1. Create employee table with the following constraints.
a) Ename should not be null values .
b) Esrno should accept 6 digits only.
c) Bdate should store the years from 1955 to 1979.
d) Sex should be by default ‘M’.
e) Salary should be between 20000 to 40000.
f) Mgrsrno should be foreign key for employee table esrno.

2. Create department table with the following constraints.


a) Dname should be (RESEARCH, ADMIN, PROJECT, ACADEMIC) (case Sensitive)
b) Dnumber should be positive and <= 4 only.

3. Create Department locations table with the following constraints.


a) Dnumber should be positive and <= 4 only.
b) Dlocations are (SINGAPORE, INDIA, QUUENSLAND, LONDON).

4. Create project table with the following constraints.


a) Pname should be (NETWORKING, BIO INFORMATICS, LINUX).
b) Plocation should be (KOREA, SOUTH AFRICA, INDIA).

5. Create table works_on with the following constraints.


a) all the coloumns should be > 0.
EMPLOYEE
ENAME ESRNO BDATE ADDRESS S SALARY MGRSRNO DNO
--------------- ---------- --------- --------------- - ---------- ---------- ----------
AJIT NAYAK 133100 25-APR-55 73 BOSTON M 35000 1
SATYA 495823 17-JUL-66 26 FINE OAK M 32770 133100 4
AJIT BEHERA 315152 09-JUL-71 10 KALINGA M 32802 133100 3
UMASHANKAR 216852 17-JUL-67 26 FINE OAK M 32770 133100 2
BHAGWAT 215152 23-MAR-71 55 FLORIDA M 32802 216852 2
MEENAKSHI 334548 25-APR-79 73 BRIKLY F 25125 315152 3
JASWASI 215485 12-AUG-79 17 BOSTON M 20500 495823 4
NIHAR NAYAK 334524 17-DEC-66 73 DALLAS M 29105 315152 3
DEBASMITA 295485 16-APR-70 1 QUEENS LAND F 20500 216852 2

DEPARTMENT DEPT_LOCATIONS
DNAME DNUMBER MGRSRNO MGRSTARTD DNUMBER DLOCATION
---------- ---------- ---------- --------- ---------- ---------------
RESEARCH 4 495823 20-APR-99 2 SINGAPORE
ADMIN 1 133100 06-JAN-88 1 INDIA
PROJECT 2 216852 17-JUL-99 4 QUUENSLAND
ACADEMIC 3 315152 20-DEC-89 3 LONDON

WORKS_ON
PROJECT
ESRNO PNO HOURS
PNAME PNUMBER PLOCATION DNUM ---------- ---------- ----------
--------------- ---------- --------------- ---------- 315152 19 1.25
NETWORKING 11 KOREA 4 334548 19 3.28
BIO INFORMATICS 19 SOUTH AFRICA 3 215485 17 1.25
LINUX 17 INDIA 2 295485 17 5.35
334548 19 2.54
WORKS_ON 295485 17 7.2
216852 17 2.41
ESRNO PNO HOURS 334524 19 3.24
---------- ---------- ------- 295485 17 1.36
495823 11 5.27 495823 11 2.36
215152 17 2.32 215152 17 1.25
495823 11 4.15 495823 11 3.14
315152 19 2.05
334548 19 2.5
215485 17 2.34

Das könnte Ihnen auch gefallen