Note that the EMPLOYEES and the DEPARTMENTS tables refereed in the following que
ID: 3693633 • Letter: N
Question
Note that the
EMPLOYEES
and the
DEPARTMENTS
tables refereed in the following questions are the ones in
the
HR
account.
•
Q1: What is a view?
•
Q2: What is the difference between a view and a table?
•
Q3: What is a view used for?
•
Q4: Give the SQL statement that creates a view called
M10V01
, which consists of first name, last name,
salary, and hire date of employees with salary more than 3000 and hired in 2004.
•
Q5: Give the SQL statement that creates a view called
M10V02
, which consists of first name, last name,
salary, and hire date of employees with first name starts and ends with ’A’ and ’a’ respectively.
•
Q6: Give the SQL statement that creates a view called
M10V03
, which consists of first name, last name,
department id of employees
LEFT
OUTER
JOIN
on table
DEPARTMENTS
using the
MANAGER
ID
as
the join condition.
•
Q7: Give the SQL statement that finds the average salary for employees via
M10V01
.
•
Q8: Give the SQL statement that increases the salary of Jason Mallin by 20% via
M10V01
.
•
Q9: Give the SQL statement that counts the number of employees via
M10V02
.
•
Q10: Give the SQL statement that deletes
M10V03
.
•
Q11: What is a materialized view?
•
Q12: What is the difference between a view and a materialized view?
Explanation / Answer
1.a view is a virtual table table that can contain entire rows or selected rows of a table.The fields in a view are fields from one or more real tables in the database.
2. A table contains data, a view is just a SELECT statement which has been saved in the database.
3.view is used for store the result of select statement or to combine the fields from varios tables.
4.CREATE OR REPLACE VIEW M10V01 AS
select first name,last name,salary,hair date where salary>3000 and hire date like '%2004'
5.CREATE OR REPLACE VIEW M10V01 AS
select first name,last name,salary,hair date where first name like 'A%a';
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.