MySQL Queries

1. Write the SQL query to get third and fourth highest value from Employee table.

2. Write the SQL query to get duplicate rows from Salary Table with "No of times" duplicate row exists.
select *,count(*) as total from salary group by employee_id having total>1;

3. Write a SQL query to view the employee name, salary who get Highest and Lowest salary using Sub-Query.

4. Write a SQL Query to view the number of occurrences of each occupation in Occupations table. Sort the occurrences in ascending order, and output them in the following format: There are a total of [occupation_count] [occupation_name]s.
select occupation, count(*) as total from occupations group by occupation order by total;

5. Write a SQL query to find out the employee names where the name starts with "j" and ends with "n" and name exactly has length 4.
select * from employee where name like 'j_%_%n';

Comments

Popular posts from this blog

WP register_post_type() with custom CMB2 meta box

Git post receive setup at server for git push to the production from local machine