[go: up one dir, main page]

0% found this document useful (0 votes)
34 views2 pages

SQL Query Solutions

The document provides a series of SQL queries for retrieving various employee-related data from an Employee table. It includes queries for displaying employee details, unique job types, salary filters, and specific conditions such as hire dates and department numbers. Each query is formatted with the necessary SQL syntax and intended outputs for clarity.

Uploaded by

bishramoraon896
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views2 pages

SQL Query Solutions

The document provides a series of SQL queries for retrieving various employee-related data from an Employee table. It includes queries for displaying employee details, unique job types, salary filters, and specific conditions such as hire dates and department numbers. Each query is formatted with the necessary SQL syntax and intended outputs for clarity.

Uploaded by

bishramoraon896
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SQL Query Solutions

1. Query to display Employee Name, Job, Hire Date, Employee Number; for each employee with the

Employee Number appearing first:

SELECT Eno AS Employee_Number, Ename AS Employee_Name, Job_type AS Job, Hire_date

FROM Employee;

2. Query to display unique Jobs from the Employee Table:

SELECT DISTINCT Job_type

FROM Employee;

3. Query to display the Employee Name concatenated by a Job separated by a comma:

SELECT CONCAT(Ename, ', ', Job_type) AS Employee_Job

FROM Employee;

4. Query to display all the data from the Employee Table. Separate each column by a comma and

name the said column as THE_OUTPUT:

SELECT CONCAT(Eno, ', ', Ename, ', ', Job_type, ', ', Manager, ', ', Hire_date, ', ', Dno, ', ',

Commission, ', ', Salary) AS THE_OUTPUT

FROM Employee;

5. Query to display the Employee Name and Salary of all the employees earning more than $2850:

SELECT Ename AS Employee_Name, Salary

FROM Employee

WHERE Salary > 2850;


6. Query to display Employee Name and Department Number for the Employee No=7900:

SELECT Ename AS Employee_Name, Dno AS Department_Number

FROM Employee

WHERE Eno = '7900';

7. Query to display Employee Name and Salary for all employees whose salary is not in the range of

$1500 and $2850:

SELECT Ename AS Employee_Name, Salary

FROM Employee

WHERE Salary NOT BETWEEN 1500 AND 2850;

8. Query to display Employee Name and Department No. of all the employees in Dept 10 and Dept

30 in alphabetical order by name:

SELECT Ename AS Employee_Name, Dno AS Department_Number

FROM Employee

WHERE Dno IN (10, 30)

ORDER BY Ename;

9. Query to display Name and Hire Date of every Employee who was hired in 1981:

SELECT Ename AS Employee_Name, Hire_date

FROM Employee

WHERE YEAR(Hire_date) = 1981;

10. Query to display Name and Job of all employees who don't have a current Manager:

SELECT Ename AS Employee_Name, Job_type AS Job

FROM Employee

WHERE Manager IS NULL;

You might also like