Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.Given two relation schema with referential integrity constraints as follows, Schema: EMPLOYEE(SSN, NAME, AGE, SALARY, SUPERSSN, DNO) DEPARTMENT(DNUMBER, DNAME, MGRSSN, MGRSTARTDATE) Referential Integrity Constraints: EMPLOYEE.SUPERSSN

1.Given two relation schema with referential integrity constraints as follows,

Schema: EMPLOYEE(SSN, NAME, AGE, SALARY, SUPERSSN, DNO) DEPARTMENT(DNUMBER, DNAME, MGRSSN, MGRSTARTDATE)

Referential Integrity Constraints: EMPLOYEE.SUPERSSN references to EMPLOYEE.SSN EMPLOYEE.DNUMBER references to DEPARTMENT.DNUMBER DEPARTMENT.MGRSSN references to EMPLOYEE.SSN

Please select the correct set of SQL statements to create these two database tables and enforce these referential integrity constraints correctly. =========================================================================================================================== A: 1. Create table EMPLOYEE: create table EMPLOYEE (name varchar2(19) not null, ssn char (9), bdate date, sex char(3), salary number(8,2), superssn char(9), dno varchar(8), constraint empPK primary key (ssn), constraint empsuperFRK foreign key (superssn) references employee (ssn) disable) 2. Create table DEPARTMENT: create table DEPARTMENT (dname varchar2(15) not null, dnumber varchar(8), mgrssn char(9), mgrstartdate date, constraint departPK primary key (dnumber), constraint departUK unique (dname), constraint departFRK foreign key (mgrssn) references employee (ssn) disable) 3. Add constraint to EMPLOYEE table alter table employee add (constraint empdnoFRK foreign key (dno) references department(dnumber)) 4. Enable the constraints: alter table EMPLOYEE enable constraint empsuperFRK; alter table DEPARTMENT enable constraint departFRK;

-------------------------------------------------------------------------------------------------------- B: 1. Create table DEPARTMENT: create table DEPARTMENT (dname varchar2(15) not null, dnumber varchar(8), mgrssn char(9), mgrstartdate date, constraint departPK primary key (dnumber), constraint departUK unique (dname)) 2. Create table EMPLOYEE: create table EMPLOYEE (name varchar2(19) not null, ssn char (9), bdate date, sex char(3), salary number(8,2), superssn char(9), dno varchar(8), constraint empPK primary key (ssn), constraint empsuperFRK foreign key (superssn) references employee (ssn), constraint empdnoFRK foreign key (dno) references department(dnumber) disable) 3. Add constraint to DEPARTMENT table alter table DEPARTMENT add (constraint departFRK foreign key (mgrssn) references employee(ssn)) 4. Enable the constraints: alter table EMPLOYEE enable constraint empsuperFRK; alter table EMPLOYEE enable constraint empdnoFRK;

------------------------------------------------------------------------------------- C: 1. Create table DEPARTMENT: create table DEPARTMENT (dname varchar2(15) not null, dnumber varchar(8), mgrssn char(9), mgrstartdate date, constraint departPK primary key (dnumber), constraint departUK unique (dname) disable) 2. Create table EMPLOYEE: create table EMPLOYEE (name varchar2(19) not null, ssn char (9), bdate date, sex char(3), salary number(8,2), superssn char(9), dno varchar(8), constraint empPK primary key (ssn), constraint empsuperFRK foreign key (superssn) references employee (ssn)); 3. Add constraint to DEPARTMENT table alter table DEPARTMENT add (constraint departFRK foreign key (mgrssn) references employee(ssn)) 4. Add constraint to EMPLOYEE table alter table EMPLOYEE add (constraint empdnoFRK foreign key (dno) references department(dnumber))

---------------------------------------------------------------------------------------------- D: 1. Create table DEPARTMENT: create table DEPARTMENT (dname varchar2(15) not null, dnumber varchar(8), mgrssn char(9), mgrstartdate date, constraint departPK primary key (dnumber), constraint departUK unique (dname), constraint departFRK foreign key (mgrssn) references employee (ssn) disable) 2. Create table EMPLOYEE: create table EMPLOYEE (name varchar2(19) not null, ssn char (9), bdate date, sex char(3), salary number(8,2), superssn char(9), dno varchar(8), constraint empPK primary key (ssn), constraint empsuperFRK foreign key (superssn) references employee (ssn), constraint empdnoFRK foreign key (dnodisable) 3. Add constraint to EMPLOYEE table alter table employee add (constraint empdnoFRK foreign key (dno) references department(dnumber)) 4. Enable the constraints: alter table EMPLOYEE enable constraint empsuperFRK; alter table DEPARTMENT enable constraint departFRK;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions

Question

2. Identify the employees who are included in the plan.

Answered: 1 week ago

Question

7. Discuss the implications of a skill-based pay plan for training.

Answered: 1 week ago