SQL Programming Questions and Answers 12th Class
SQL Programming Questions and Answers 12th Class
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;