the question is: 1. Write the DDL statement for defining the Employee table. (Assume that the Reward and Department tables have already been created)
Instructions:
Write the suitable SQL statement to answer the following questions based on the following tables ( image for better table)
Table Name: Employee
EMP_ID FNAME LNAME SALARY JOIN_DATE DEP_NO
101 John Abraham 10000 01-JAN-13 11
202 Michael Clarke 80000 01-JAN-13 22
303 Roy Thomas 70000 01-FEB-13 11
404 Tom Jose 60000 01-FEB-13 22
505 Jerry Pinto 65000 01-FEB-13 22
606 Philip Mathew 75000 01-JAN-13 33
707 Thomas Jack 65000 01-JAN-13 33
Table Name: Reward
EMP_ID REWARD_DATE AMOUNT
101 01-FEB-13 5000
202 01-FEB-13 3000
303 01-FEB-13 4000
101 01-JAN-13 4500
202 01-JAN-13 3500
Table Name: Department
DEP_NO DEP_NAME
11 Banking
22 Insurance
33 Services
44 Marketing
the question is:
1. Write the DDL statement for defining the Employee table.
(Assume that the Reward and Department tables have already been created)
Step by step
Solved in 2 steps with 1 images
in the question it said that "Assume that the Reward and Department tables have already been created " so i don't need to create the tables + there is a link from rewards and department to the Employee as in the picture for a reference,
my answer is :
CREATE TABLE Employee (
EMP_ID CHAR(3) NOT NULL,
FNAME VARCHAR(15) NOT NULL,
LNAME VARCHAR(15) NOT NULL,
SALARY DECIMAL(10,2),
JOIN_DATE DATE
DEP_NO CHAR(2) NOT NULL
PRIMARY KEY(EMP_ID),
FOREIGN KEY(EMP_ID) REFRENCE Rewrad,
FOREIGN KEY(DEP_NO) REFRENCE Department
);
is it wrong ?