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

SQL Programming Questions and Answers 12th Class

Uploaded by

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

SQL Programming Questions and Answers 12th Class

Uploaded by

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

SQL Programming Questions and

Answers - 12th Class


1. Write a SQL query to display the first 5 characters of all employee names from the
Employees table.

SQL Query:
SELECT SUBSTRING(employee_name, 1, 5) AS first_five_characters
FROM Employees;

2. Write a SQL query to retrieve all employees who joined after '2023-01-01' from the
Employees table.

SQL Query:
SELECT *
FROM Employees
WHERE join_date > '2023-01-01';

3. Write a SQL query to find the total number of employees in each department from the
Employees table.

SQL Query:
SELECT department_id, COUNT(*) AS total_employees
FROM Employees
GROUP BY department_id;

4. Write a SQL query to display all the employees whose salary is between 30000 and 50000
from the Employees table.

SQL Query:
SELECT *
FROM Employees
WHERE salary BETWEEN 30000 AND 50000;

5. Write a SQL query to update the salary of employees in department 2 by 10%.


SQL Query:
UPDATE Employees
SET salary = salary * 1.10
WHERE department_id = 2;

You might also like