Learn the basics of SQL queries quickly Select Data The SELECT statement retrieves data from a table. The asterisk (*) selects all columns. SELECT * FROM employees; This command retrieves the name and salary of employees. SELECT name, salary FROM employees; Filtering Data To filter results, you can use the WHERE clause: SELECT name, salary FROM employees WHERE salary > 60000; Sorting and Grouping of Data ORDER BY: Used to sort the result set. SELECT * FROM employees ORDER BY salary DESC; GROUP BY: Groups rows sharing a property. SELECT position, COUNT(*) FROM employees GROUP BY position; The SELECT statement retrieves data from a table. The asterisk (*) selects all columns. SELECT * FROM employees; This command retrieves the name and salary of employees. SELECT name, salary FROM employees; To filter results, you can use the WHERE clause: SELECT name, salary FROM employees WHERE salary > 60000; ORDER BY: Used to sort the result set. SELECT * FROM employees ORDER BY salary DESC; GROUP BY: Groups rows sharing a property. SELECT position, COUNT(*) FROM employees GROUP BY position;