Practice Questions on MYSQL 25-07-23

  1. Basic SELECT statement: Retrieve all columns from the “employees” table.

  2. Filtering data: Retrieve the names and salaries of employees whose salary is greater than 50,000 from the “employees” table.

  3. Sorting data: Retrieve the names and hire dates of employees from the “employees” table, sorted by hire date in ascending order.

  4. Aggregation: Calculate the average salary of all employees from the “employees” table.

  5. Joining tables: Retrieve the names of employees and the names of their respective departments from the “employees” table and the “departments” table.

  6. Conditional filtering: Retrieve the names and salaries of employees from the “employees” table. If the salary is greater than $100,000, display “High Salary,” otherwise display “Normal Salary.”

  7. Grouping and aggregation: Calculate the total salary for each department from the “employees” table and group the results by department.

  8. Wildcards: Retrieve the names of employees whose names start with “J” from the “employees” table.

  9. Updating data: Update the salary of an employee named “John Doe” to $60,000 in the “employees” table.

  10. Deleting data: Delete all employees whose hire date is before 2020 from the “employees” table.

2 Likes
  1. Basic SELECT statement: Retrieve all columns from the “employees” table.
    SELECT * FROM EMPLOYEES;
  1. Filtering data: Retrieve the names and salaries of employees whose salary is greater than 50,000 from the “employees” table.

SELECT EMP_NAME,EMP_SALARY
FROM EMPLOYEES
WHERE EMP_SALARY>=50000;