sql tables and data

4
  SQL TABLES AND DATA www.iibceducation .com Page 1 EMPLOYEES Table SQL TABLES AND DATA NAME NULL? TYPE EMPID NOT NULL BIGINT ENAME NOT NULL NVARCHAR(20) JOBID NOT NULL NVARCHAR(10) MGRID BIGINT HIREDATE DATE SALARY NOT NULL BIGINT COMMISSION INT DEPTID NOT NULL BIGINT Constraints  EMPID is primary key  Foreign Key for DEPTID should references DEPTID in Departments Table  Foreign Key for MGRID should references EMPID in Employees Table  Foreign Key for JOBID should references JOB_ID in Jobs Ta ble DEPARTMENTS Table NAME NULL? Type DEPTID NOT NULL BIGINT DNAME NOT NULL NVARCHAR(30) MGRID BIGINT LOCATION_ID BIGINT

Upload: shivuhc

Post on 03-Nov-2015

224 views

Category:

Documents


0 download

DESCRIPTION

.NET

TRANSCRIPT

  • SQL TABLES AND DATA

    www.iibceducation.com Page 1

    EMPLOYEES Table

    SQL TABLES AND DATA

    NAME NULL? TYPE EMPID NOT NULL BIGINT ENAME NOT NULL NVARCHAR(20) JOBID NOT NULL NVARCHAR(10) MGRID BIGINT HIREDATE DATE SALARY NOT NULL BIGINT COMMISSION INT DEPTID NOT NULL BIGINT

    Constraints

    EMPID is primary key Foreign Key for DEPTID should references DEPTID in Departments Table Foreign Key for MGRID should references EMPID in Employees Table Foreign Key for JOBID should references JOB_ID in Jobs Table

    DEPARTMENTS Table

    NAME NULL? Type DEPTID NOT NULL BIGINT DNAME NOT NULL NVARCHAR(30) MGRID BIGINT LOCATION_ID BIGINT

  • SQL TABLES AND DATA

    www.iibceducation.com Page 2

    Constraints

    DEPTID is primary key DNAME should be unique Foreign Key MGRID should references EMPID in Employees Table Foreign Key LOCATION_ID should references LOCATION_ID in Locations Table

    LOCATIONS Table

    NAME NULL? TYPE LOCATION_ID NOT NULL BIGINT STREEET_ADDERSS NVARCHAR(40) POSTAL_CODE NVARCHAR(12) CITY NOT NULL NVARCHAR(30) STATE NVARCHAR(25) COUNTRY_ID NOT NULL CHAR(2)

    Constraints

    LOCATION_ID should be primary key POSTAL_CODE Should be unique Foreign Key COUNTRY_ID should references COUNTRY_ID in Countries Table

  • SQL TABLES AND DATA

    www.iibceducation.com Page 3

    COUNTRIES Table

    Name Null? Type COUNTRY_ID NOT NULL CHAR(2) COUNTRY_NAME NOT NULL NVARCHAR(40) REGION NVARCHAR(20)

    Constraints

    COUNTRY_ID should be primary key COUNTRY_NAME Should be unique

    JOBS Table

    NAME NULL? TYPE JOB_ID NOT NULL NVARCHAR(10) JOB_TITLE NOT NULL NVARCHAR(40) MIN_SALARY BIGINT MAX_SALARY BIGINT

    Constraints

    JOB_ID should be primary key MIN_SALARY Should be greater than 2000 MAX_SALARY Should be between 2000 and 50000

  • SQL TABLES AND DATA

    www.iibceducation.com Page 4

    JOB_GRADES Table

    NAME NULL? TYPE GRADE_LEVEL NOT NULL NVARCHAR(3) LOWEST_SAL NOT NULL BIGINT HIGHEST_SAL NOT NULL BIGINT