SQL Query Practice

1. Retrieve Employee Names

Write an SQL query to retrieve all employee names in alphabetical order.

idnamesalary
1Amit40000
2Ravi55000
3Suman60000
4Neha45000
5Mohit70000

2. Find Employees with High Salary

Write an SQL query to find employees earning more than 50,000.

3. Count Customers by City

Write a query to count how many customers are in each city.

idnamecity
1RajVaranasi
2SitaDelhi
3AkashVaranasi
4NitinMumbai
5MeenaDelhi
6RohitVaranasi

4. Find the Second Highest Salary

Write a query to find the second-highest salary without using LIMIT or OFFSET.

5. Find Customers Who Placed More Than 3 Orders

Write a query to find customers who have placed more than 3 orders.

Customers
idname
1Raj
2Sita
3Akash
4Nitin
Orders
order_idcustomer_id
1011
1022
1033
1041
1051
1062
1071
1083
1092
1103