which is more accurate? and are they even right?
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:
Write the DDL statement for defining the Employee table.
(Assume that the Reward and Department tables have already been created)
my solution is this (
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
);
)
my other solution is (
CREATE TABLE Employee (
EMP_ID INTEGER PRIMARY KEY,
FNAME VARCHAR2(15),
LNAME VARCHAR2(15),
SALARY INTEGER,
JOIN_DATE DATE,
DEP_NO INTEGER
);
)
which is more accurate? and are they even right?
Step by step
Solved in 2 steps