Employee Table Schema:
Column Name Data Type
id int (PK)
name varchar(100)
department varchar(50)
salary decimal(10,2)
Sample Data:
id name department salary
1 John Smith IT 60000.00
2 Jane Doe HR 55000.00
3 Jim Brown IT 62000.00
4 Jake Green IT 58000.00
5 Jill White Sales 50000.00
HQL Questions:
1. Retrieve names of employees whose salary is above 50000:
2. Retrieve total number of employees:
3. Retrieve highest salary from the employee table:
4. Retrieve employees whose names start with 'J' and work in the 'IT' department:
5. Retrieve employees sorted by salary in descending order
6. Retrieve employees who earn more than the average salary
7. Retrieve employees who have a salary between 40000 and 60000 (inclusive)
8. Retrieve employees whose names contain the substring 'an'
9. Retrieve employees grouped by department and ordered by average salary within
each department in descending order
10. Retrieve employees whose salaries are within the top 10% of salaries in the
company