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

Assignment Questions

The document describes an employee table schema with sample data and HQL questions to retrieve information from the table. The schema includes columns for id, name, department, and salary. Sample data includes 5 employees. The HQL questions cover retrieving names by salary, total employees, highest salary, employees by name and department, sorting by salary, comparing to average salary, salary range queries, substring searches, grouping and ordering by department average salary, and top 10% salaries.

Uploaded by

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

Assignment Questions

The document describes an employee table schema with sample data and HQL questions to retrieve information from the table. The schema includes columns for id, name, department, and salary. Sample data includes 5 employees. The HQL questions cover retrieving names by salary, total employees, highest salary, employees by name and department, sorting by salary, comparing to average salary, salary range queries, substring searches, grouping and ordering by department average salary, and top 10% salaries.

Uploaded by

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

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

You might also like