1
CHECK (weight > 0 AND weight <= 5)
2a
CREATE TABLE Employee(eid INT, name VARCHAR(50), salary INT);
CREATE TABLE LeavingTime(eid INT, date DATE, time VARCHAR(50)
PRIMARY KEY(eid, date),
FOREIGN KEY(eid) REFERENCES Employee(eid)
);
b
INSERT INTO LeavingTime VALUES(143, 2015-4-1, '4PM');
c
Nothing would happen since the leaving time would just record another leaving time and we are not updating the Employee table. However, if we delete the employee from the table when they leave, this would cause an error. (I'm little confused about the requirement of the hw)
d
DELETE FROM Employee
WHERE eid NOT IN
( SELECT eid FROM LeavingTime
)
1
Access time = seek time + rotational latency + transfer time
Seek time : 10ms
rotation latency = (1000ms/sec * 60sec/min ) / 6000 RPM = 10ms for one cycle, so the avg is 5ms
transfer time = rotation time / sector per track = 10 / 500 = 1/50 ms = 0.02 ms
so the access time is 10 + 5 + 0.02 = 15.02 ms
2