2. Suppose that the company from problem 1 has a table describing employees of t
ID: 3875948 • Letter: 2
Question
2. Suppose that the company from problem 1 has a table describing employees of the company which contains the following information: Employee last name Employee first name Employee number (Each employee has a different number assignment by the company.) Coporate email (Each employee has a different email.) birth date home address company phone number (Not all employees have a separate line.) home phone number Home addresses and home phone numbers may not be unique as married couples do work at the company. The IT department keeps another table that links workstations to the employees to whom they are assigned. Each employee has a workstation. a. Write the table schema for the two tables described above. Use the format from problem 1 for the schema. b. Identify the primary and alternate keys for the two tables. You do not have to identify the superkeys. c. Identify the necessary foreign keys in the IT department's table to link the employees and workstations.
Explanation / Answer
Here you go,
// Sequence of steps.
1) Create schema named employeeInformation
2) Create table named Employees with given details and constraint
3) create table named WorkStations with given details and required constraints
//
CREATE SCHEMA employeeInformation;
GO
CREATE TABLE employeeInformation.Employees (
employeeNumber int(10)[NOT NULL],
lastName varchar2(20),
firstName varchar2(20),
corporateEmail varchar2(50) [NOT NULL],
companyPhoneNumber int(12),
birthDate DATE,
homeAddress varchar2(100),
homePhoneNumer int(12),
CONSTRAINT employee_pk PRIMARY KEY (employeeNumber)
);
CREATE TABLE employeeInformation.WorkStations (
workStationId int(10)[NOT NULL],
employeeNumber int(10)[NOT NULL],
CONSTRAINT employee_pk PRIMARY KEY (workStationId),
CONSTRAINT employee_fk FOREIGN KEY (employeeNumber) REFERENCES Employees(employeeNumber)
);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.