DBMSSRGC Employee
DBMSSRGC Employee
DBMSSRGC Employee
);
Query::
job_id AS job,
salary * 12 AS annual_salary
FROM employee;
Ques3. Write a sql query to get the total number of employee working in the company.
Select count(*)
from employee
Ques4. Write query to get the total salary being paid to all employees.
FROM employee;
Ques5. Write a SQL query to get the maximum and minimum salary from the employee table.
SELECT
MAX(salary) AS max_salary,
MIN(salary) AS min_salary
FROM employee;
Ques 6. Write a SQL query to display the name of the employee in order to earning from lowest salary
to highest.
SELECT
FROM
employee
Ques 7. Write a SQL query to display the name of the employee in order to earning from highest salary
to lowest .
SELECT
FROM
employee
Ques 8. Write a Oracle SQL query to display the name of the employees in
order to alphabetically ascending order
SELECT
FROM
employee
ORDER BY
First_name ASC,
SELECT
employee_id,
department_id,
salary
FROM
employee
ORDER BY
salary DESC;
Ques 10. Write a Oracle SQL query to display the name and their annual salary.
The result should contain those employees first who earning the highest
salary
SELECT
salary * 12 AS annual_salary
FROM
employee
ORDER BY
salary DESC;
Ques 11. Write a Oracle SQL query to display department id and total
number of employees working in each department.
FROM employee
GROUP BY department_id;
Ques 12. Write a Oracle SQL query to display the designation (job id) and
total number of employees working in each designation.
SELECT
job_id,
COUNT(*) AS total_employees
FROM
employee
GROUP BY
job_id;
Ques 13. Write a Oracle SQL query to display the department number and total
salary for each department.
SELECT
department_id,
SUM(salary) AS total_salary
FROM
employee
GROUP BY
department_id;
Ques 14 . Write a Oracle SQL query to display the department number and
maximum salary for each department.
SELECT
department_id,
SUM(salary) AS total_salary
FROM
employee
GROUP BY
department_id;
Ques 15. Write a Oracle SQL query to display the designations (job id) and
total salary allotted for each designation from the company.
SELECT
job_id,
SUM(salary) AS total_salary_allotted
FROM
employee
GROUP BY
job_id;
Ques 16. From the following tables write a SQL query to find the salesperson
and customer who reside in the same city. Return Salesman, cust_name and
city.
Ans.
SELECT
s.name AS salesman,
c.cust_name,
s.city
FROM
salesman s
Ques 17. From the following table, create a view for those salespeople who
belong to the city of New York.
Ans.
SELECT
salesman_id,
name,
city,
commission
FROM
salesman
WHERE