-
Basic SELECT statement: Retrieve all columns from the “employees” table.
-
Filtering data: Retrieve the names and salaries of employees whose salary is greater than 50,000 from the “employees” table.
-
Sorting data: Retrieve the names and hire dates of employees from the “employees” table, sorted by hire date in ascending order.
-
Aggregation: Calculate the average salary of all employees from the “employees” table.
-
Joining tables: Retrieve the names of employees and the names of their respective departments from the “employees” table and the “departments” table.
-
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.”
-
Grouping and aggregation: Calculate the total salary for each department from the “employees” table and group the results by department.
-
Wildcards: Retrieve the names of employees whose names start with “J” from the “employees” table.
-
Updating data: Update the salary of an employee named “John Doe” to $60,000 in the “employees” table.
-
Deleting data: Delete all employees whose hire date is before 2020 from the “employees” table.
2 Likes
- Basic SELECT statement: Retrieve all columns from the “employees” table.
SELECT * FROM EMPLOYEES;
- 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;