Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Database Systems 1) Create an SQL view named RichEmployeeComputers to display th

ID: 3592365 • Letter: D

Question

Database Systems

1) Create an SQL view named RichEmployeeComputers to display the COMPUTER make, model and list price for computers that are owned by employees who earn at least 500,000, using these tables

2) Write an SQL statement to display the names of the MANUFACTUREs who do not have any models in the COMPUTER table using these tables,

MANUFACTURER Name Dell IBM Gatewa Apple COMPUTER Model SerialNumber|Make 9870 8590 7840 4870 EmpNo 123 456 123 789 State TX ListPrice 649.99 Austin White Plains NY Sioux Cit Cupertino Gateway Apple Dell Dell DX4850 IA CA eMacBook Air Alienware XPS 899.00 799.99 EMPLOYEE EmploveelD 123 456 789 EmpName Salarv Uc Charlie Linus Pat 500,000 600,000 300,000 200,000 HireDate 01/02/1993 02/03/1992 01/25/1995 11/23/2003

Explanation / Answer

creating view:

vies cam be created to give access to certain specific data to users.A view also consits of rows and columns.A view can be constructed by using two or more tables,by using join conditions.

syntax for creating views:

CREATE VIEW view_name AS
SELECT col1, col2, ...
FROM table_name
WHERE condition;

Query to create the view for the above given example:

create view RichEmployeeComputers as select c.Make,c.Model, c.listPrice from COMPUTER c inner join EMPLOYEE e on c.EmpNo=e.EmployeeID and e.Salary = any(select Salary from EMPLOYEE where Salary >500000)