Database Systems (Please Help) Write a set of correct SQL CREATE TABLE statement
ID: 3861165 • Letter: D
Question
Database Systems
(Please Help)
Write a set of correct SQL CREATE TABLE statements (Do REMEMBER to include all PK/FK constraints in your response) for a database that implements the following business rules:
· A business is organized into many departments, and each department can only belong to one company.
· A department employees one or more employees, each department is managed by zero or one employee, and each employee will have one manager who manages many employees.
· Each employee may or may not have dependents who can belong only to one employee.
· Each employee may be located in a single office which may house from zero to four employees.
**********************My Relational SCHEMA (3NF) ***********************************************
Business(departmentID)
Department(departmentID, employeeID)
Employee(employeeID, managerID,office, dependants)
Manager(managerID, name)
Explanation / Answer
create table departments(
deptid number,
deptname varchar2(100),
primary key (deptid)
);
create table business(
businessid number,
businessname varchar2(100),
deptid number,
foreign key (deptid) refrences department (deptid),
primary key businessid
);
create table employee (
employeeid number,
managerid number,
office number,
primary key employeeid,
foreign key (managerid) refrences manager(managerid)
);
a
create table manager(
managerid nmber,
name varchar2(100),
primary key(managerid)
);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.