SQL Comand
SQL Comand
W_ID INT,
FIRST_NAME VARCHAR(25),
LAST_NAME VARCHAR(25),
DEPARTMENT VARCHAR(25),
JOINING_DATE DATETIME,
SALARY INT(15),
);
-using ORDER BY
6.Write an SQL query to show the salary of the workers in the descending order.
Ans: SELECT salary FROM worker
ORDER BY salary DESC;
-using EQUIJOIN
15.Write an sql query which can join worker id, fetch worker names form worker
table and worker�s reference id, bonus amount from bonus table.
Ans: SELECT worker.w_id, worker.CONCAT(First_name, ' ', Last_Name) As
Worker_Name,bonus.Worker Ref_Id, bonus.bonus amount from worker,bonus
where w_id= Worker Ref _Id;
Create a simple view as 'Managers_info' to show each manager's name, salry and
branch name where m_salary is greater then or equal to 85000
Create a view as 'Employees_info' to show each employee's name, salry, post and
branch name
CREATE VIEW employees_info AS
SELECT e_name,e_salary,e_post,branch_name
FROM employee,manager
WHERE employee.m_id=manager.m_id;