0% found this document useful (0 votes)
4 views

SQL Exercise

Uploaded by

Dileep Prabakar
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

SQL Exercise

Uploaded by

Dileep Prabakar
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 4

id name department salary

1 John Smith HR 60000


2 Jane Doe Marketing 75000
3 Bob Johnson Sales 80000
4 Sara Lee HR 55000
5 Mike Jones Sales 70000
6 Lisa Kim Marketing 65000
7 Tom Brown HR 50000
8 Mary Davis Sales 90000
9 David Lee Marketing 85000
10 Amy Chen HR 45000

select name,department , salary from emp_data where salary <1000


select * from emp_data

select namf
1.select * from emp_data where salary < 50000; emp_data where salary <
2.INSERT INTO emp _data (name) values( katie);
3.UPDATE emp_ data set ( et salary where i
4.DELETE emp_ data where dpt =HR;
5.select count (*) form emp_data;
6.select * from emp_data avg(salary)
7.select TOP 5 * from emp _data;
8.select * from emp_data where like 'j%';
9. select* from emp_data MAX(salary);
10
1. How would you retrieve all employees whose salary is greater than $50,000?
2. How would you add a new employee to the employees table?
3. How would you update the salary of an employee with the ID 123?
4. How would you delete all employees whose department is "HR"?
5. How would you retrieve the total number of employees in each department?
6. How would you retrieve the average salary of employees in the "Sales" department?
7. How would you retrieve the top 5 highest paid employees?
8. How would you retrieve the names of all employees whose name starts with the letter "J"?
9. How would you retrieve the highest salary in the employees table?
10. How would you retrieve the names of all employees who earn more than their department average salary?

1. How would you retrieve all columns and rows from the employees table?
2. How would you retrieve only the names of all employees from the employees table?
3. How would you retrieve the names and salaries of all employees whose salary is greater than $60,000?
4. How would you retrieve the distinct department names from the employees table?
5. How would you retrieve the names and salaries of the 3 highest paid employees?
6. How would you retrieve the names and salaries of the 5 lowest paid employees?
7. How would you retrieve the names and salaries of all employees sorted in ascending order by salary?
8. How would you retrieve the names and salaries of all employees sorted in descending order by salary?
9. How would you retrieve the names and salaries of all employees whose department is "Marketing" or "Sales
10. How would you retrieve the names and salaries of all employees whose department is not "HR"?
letter "J"?

department average salary?

s greater than $60,000?

nding order by salary?


ending order by salary?
ment is "Marketing" or "Sales"?
ment is not "HR"?

You might also like