Question

In: Computer Science

Consider the below database schema for company ABC: Employee(empNo, givename, famname, gender, DOB) Supervises(super_empNo*, empNo*, description)...

Consider the below database schema for company ABC:

Employee(empNo, givename, famname, gender, DOB)

Supervises(super_empNo*, empNo*, description)

Department(deptNo, name, manager_empNo*)

Dependent(empNo*, name, relationship)

Project(projNo, description, deptNo*)

The relations Employee, Supervises, Department, Dependent and Project keep data for employees, supervision, departments, dependents of employees and projects of ABC.

For the database, primary keys, and parent and child relations for foreign keys are annotated. The meaning of most attributes is self-explanatory. Answer questions below.

Your answer to each question must be according to the given database schema and instance.

1.1. (2 points) Does the primary key of Supervises (super_empNo, empNo) ensure that each supervisor supervises a different employee? Explain your answer.

1.2. (5 points) Is it possible that a project has no department? Explain why/why not. If possible, identify any data integrity constraints that can be placed on the Project table to prevent this? Can a project have many departments? Explain using the data integrity constraints on the Project table.

1.3. (2 points) Is it possible that a supervisor does not supervise any employees? Explain your answer using the data constraints on the Supervises table.

1.4 (3 point) Assuming that every department is working on at least one project (and the Department table contains a record with department number 8), can the SQL statement below be successfully executed? Explain your answer. DELETE FROM Department WHERE deptNo = 8;

Solutions

Expert Solution

Answer 1.1: Yes. The primary key of Table Supervises (super_empNo, empNo) ensure
                    that each supervisor supervises a different employee.

Since the combination of Super_empNo and empNo is a primary key of  table Supervises. Primary key cannot be NULL. In addition, there is no repeated values exist in the primary key.

As the combination of super_empNo and empNo is a primary key. So, it cannot be Null and no repeated value exit. Therefore, it ensures each Supervisor supervises a different employee.

Answer 1.2:   No, it is not possible that a project has no department.

                       Since the dept no in the project table is a primary key. According to       
                       Entity integrity constraints, “primary key cannot be null”.

                       Therefore, they must be unique value in the dept no column, which is also,
                       not null. Therefore, each project has some unique and not null department.

                       Each project does not have many department. In that case, dept no of project table is not unique. Which violate
the rule of primary key constraint data integrity.

Answer 1.3: No, it is not possible that a supervisor does not supervise any employees.

             Since the combination of super_empNo* and empNo* in the Supervises table is a primary key. According to   Entity integrity constraints, “primary key cannot be null”. Therefore, a supervisor must supervise any employees.

Answer 1.4: DELETE FROM Department WHERE deptNo = 8;

                     The above query cannot be executed successfully. According to Referential Integrity Constraint- You can't delete a record from a primary table if matching records exist in a related table.

The deptNo in the department table is a primary key to the project table. So, we cannot delete it.


Related Solutions

Consider the following relational database schema:             employee(employee-name, employee-id, street, e-city)             works(employee-
Consider the following relational database schema:             employee(employee-name, employee-id, street, e-city)             works(employee-id, company-id, salary)             company(company-name, company-id, c-city)             manages(employee-id, manager-id) Specify the following queries on this database schema using the relational operators we discussed in class. Write your answers on a separate sheet of paper in the order that they are specified below. Retrieve the name and address of employees who work for First Bank Corporation. Retrieve the name, street address, and city of residence of all employees...
Consider the following database schema for a BOOKSTORE database: Books (bookid, title, author, year) Customers (customerid,...
Consider the following database schema for a BOOKSTORE database: Books (bookid, title, author, year) Customers (customerid, name, email) Purchases (customerid, bookid, year) Reviews (customerid, bookid, rating) Pricing (bookid, format, price) The Books relation stores information about books sold by the bookstore. Note that bookid is the primary key. An example tuple is as follows: (105, 'JAVA PROGRAMMING', 'JOHN DOE', 2001) The Customers relation stores information about the customers of the bookstore. Note that customerid is the primary key. An example...
Given the same simple Employee-Workson-Project database schema , which contains three files described as follows:
Given the same simple Employee-Workson-Project database schema , which contains three files described as follows:Emp (eid : integer, ename : string, age : integer, salary: real)Workson (eid : integer, pid : integer, hours : integer)Project (pid : integer, pname : string, budget : real, managerid : integer)Note : eid, ename, age and salary are the employee id, name, age and salary respectively. Also, hours is the number of hours worked by employee on a project. The rest of the attributes...
Consider the following database schema:                Product(maker, model, type)                PC(model, speed
Consider the following database schema:                Product(maker, model, type)                PC(model, speed, ram, hd, rd, price)                Laptop(model, speed, ram, hd, screen, price)                Printer(model, color, type, price) Give SQL statement for each of the following: (Grouping and Aggregation) Write the following queries in SQL: Find the average speed of laptops costing over $2000. Find the average price of PC’s and laptops made by manufacturer “D”. Find, for each manufacturer, the average screen size of its laptops. Find the manufacturers...
Consider the following database schema:                Product(maker, model, type)                PC(model, speed
Consider the following database schema:                Product(maker, model, type)                PC(model, speed, ram, hd, rd, price)                Laptop(model, speed, ram, hd, screen, price)                Printer(model, color, type, price) Give SQL statement for each of the following: (Subqueries, Join operations) Write the following queries in SQL: Find the makers of PC’s with a speed of at least 1200. Find the printers with the highest price. Find the laptops whose speed is lower than that of any PC. Find the model number...
SQL query exercises: Consider the following database schema:                Product(maker, model, type)              &
SQL query exercises: Consider the following database schema:                Product(maker, model, type)                PC(model, speed, ram, hd, rd, price)                Laptop(model, speed, ram, hd, screen, price)                Printer(model, color, type, price) Consider the Drivers-Cars-Reserves DB for a small rental car company:                Drivers(id, name, rating, age)                Cars(vin, maker, model, year, color)                Reserves(did, vin, date) Give SQL statement each of the following operations: Find the colors of cars reserved by Smith. Find all id’s of drivers who have a...
Give the tuple calculus expressions for each using the below schema: Make a database up if...
Give the tuple calculus expressions for each using the below schema: Make a database up if needed SPERSON(EmpID, Name, Dept) TRIP(TripID, EmpID, ToCity, StartDate, EndDate) EXPENSE(ExpID, TripID, AccountID, Amount) a) List the names and employee ID of a salesperson. b) List employee ID and employee names that took a trip(s) to New York city. c) List the names of all employees who have spent more than $700 on their trip. d) List employees' names and their IDs that have never...
Assignment 7: Congressional Vote Tracking Database Description Design an Extended E-R schema diagram for keeping track...
Assignment 7: Congressional Vote Tracking Database Description Design an Extended E-R schema diagram for keeping track of information about votes taken in the U.S. House of Representatives and Senate during the current two-year congressional session.  The database needs to keep track of each U.S. STATE's Name (e.g. Texas, New York, Pennsylvania, etc.) and include the Region of the state (whose domain is {North-east, Midwest, Southeast, West}).  Each CONGRESSPERSON in the House of Representatives is described by his or her Name, plus the...
Question 2: consider the following library relational database schema Write a program segment to retrieves the...
Question 2: consider the following library relational database schema Write a program segment to retrieves the list of books that became overdue yesterday and that prints the book title and borrower name for each. 1- Use JDBC with Java as the host language
Consider the following universal relation THE following database schema is in 4NF. What can you infer...
Consider the following universal relation THE following database schema is in 4NF. What can you infer about multi-valued dependencies? A C D A B C E E F A-It does not have multi-valued dependencies. B-The multi-valued dependency A ->-> C does not hold. If the multi-valued dependency A ->-> C held, the database would not be in 4NF. C-The multi-valued dependency A ->-> B does not hold. If the multi-valued dependency A ->-> B held, the database would not be...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT