#view 1 CREATE VIEW EmployeeDepartment AS SELECT employee.name as EmployeeName, contact, designation, Department.name As DepartmentName FROM employee INNER JOIN department on department.id =...

1 answer below »
#view 1
CREATE VIEW EmployeeDepartment
AS
SELECT
employee.name as EmployeeName,
contact,
designation,
Department.name As DepartmentName
FROM
employee
INNER JOIN
department on department.id = employee.Department_id;

#view 2
CREATE VIEW ProductSales
AS
SELECT
products.name as ProductName,
brand,
sales_description,
customer_feedback
FROM
products
INNER JOIN
products_has_sales on Products_idProducts =idProducts
INNER JOIN
Sales on idSales = Products_idProducts ;

#question 3
Select customers.name as CustName, customers.contact_no, address, products.name as ProductName, brand
from customers
inner join products on products.idProducts = customers.Products_idProducts
where quantity = 10;
#union 1
SELECT address FROM Customers
UNION
SELECT address FROM employee;
#union 2
SELECT products.idProducts FROM products
UNION DISTINCT
SELECT Products_idProducts FROM products_has_sales;
#user defined function 1
DELIMITER //
CREATE FUNCTION EmployeeDepartment(empid int) RETURNS int DETERMINISTIC
BEGIN
DECLARE deptId int;
Select Department_id into deptId where id = empid;
RETURN deptId;
END
//
DELIMITER ;
Answered 5 days AfterMay 11, 2021

Solution

Ravindra Kumar Yadav answered on May 17 2021
22 Votes

56bbbbb.PNG
delete_after.PNG
delete_after_running.PNG
delete_after_test.PNG
delete_before.PNG
delete_before_trigger_created.PNG
solution.docx
Create trigger for...

Submit New Assignment

Copy and Paste Your Assignment Here