You are required to create the following tables in a database

A Guide to SQL
9th Edition
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Philip J. Pratt
Chapter2: Database Design Fundamentals
Section: Chapter Questions
Problem 11RQ
icon
Related questions
Question

This question relates to creating and altering tables, as well as implementing constraints and referential integrity. 
Q.1.1 You are required to create the following tables in a database named SICKLEAVE:
EMPLOYEES
EMPLOYEE_ID VARCHAR(5) NOT NULL PRIMARY KEY
EMPLOYEE_NAME VARCHAR(30) NOT NULL
EMPLOYEE_SURNAME VARCHAR(30) NOT NULL
DATE_OF_BIRTH DATE NOT NULL
DOCTORS
DOCTOR_ID VARCHAR(5) NOT NULL PRIMARY KEY
DOCTOR_NAME VARCHAR(30) NOT NULL
EMPLOYEE_SICKLEAVE
EMPLOYEE_ID VARCHAR(5) NOT NULL PRIMARY KEY
FOREIGN KEY REFERENCES
EMPLOYEES(EMPLOYEE_ID)
START_DATE DATE NOT NULL PRIMARY KEY
DOCTOR_ID VARCHAR(5) NOT NULL
NUMBER_OF_DAYS SMALLINT NOT NULL

Q.1.2 Populate the tables created in Q.1.1 with the following data:
EMPLOYEES
EMPLOYEE_ ID EMPLOYEE_NAME EMPLOYEE_
SURNAME
DATE_OF_BIRTH
I0001 Dominique Woolridge 1993-04-19
I0002 Nico Baird 1991-11-19
I0003 Derek Moore 1992-06-24
I0004 Neo Petlele 1993-12-29
I0005 Andrew Crouch 1994-01-30
DOCTORS

DOCTOR_ID DOCTOR_NAME
D0001 Thabo Ntlali
D0002 Deon Coetzee
D0003 Kwezi Mbete
D0004 Trevor January
D0005 Julia Robins
EMPLOYEE_SICKLEAVE
EMPLOYEE_ID DOCTOR_ID START_DATE NUMBER_OF_DAYS
I0001 D0004 2019-01-25 2
I0002 D0001 2019-05-14 1
I0003 D0003 2019-06-07 5
I0003 D0002 2019-06-29 15
I0004 D0001 2019-08-01 3
I0005 D0004 2019-10-22 9
I0005 D0001 2019-12-28 4

 

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr