Junior — Middle
What keywords can be used to form an SQL query to extract data from a table?
sobes.tech AI
Answer from AI
To extract data from a table in SQL, the keyword SELECT is used. Usually, the query starts with SELECT, followed by a list of columns or * to select all columns, then the table is specified using the FROM keyword.
Example of a simple query:
SELECT * FROM employees;
Additional keywords are often used for filtering and sorting data:
- WHERE — to specify selection conditions
- ORDER BY — to sort the results
- LIMIT — to limit the number of returned rows
Example with filtering and sorting:
SELECT name, salary FROM employees WHERE department = 'Sales' ORDER BY salary DESC LIMIT 10;