Distinct, As, Where Flashcards
What is the primary purpose of querying data?
Retrieving specific information or subsets from a database
What command is used to specify which columns and rows to retrieve in SQL?
SELECT
What clause is used to filter results based on specific criteria in SQL?
WHERE
What does the ORDER BY
clause do?
Arranges the data in a particular order, such as ascending or descending
What is the function of the LIMIT
clause?
Restricts the number of rows returned by a query
What is an alias in SQL?
A temporary and more readable name for a table or column within a query
Which keyword is used to assign an alias in SQL?
AS
Fill in the blank: The MAX
function is used to find the _______ value in a column.
highest
True or False: The ORDER BY
clause can only sort data in ascending order.
False
What is a practical use of the WHERE
clause in SQL?
Filtering results based on conditions, such as retrieving employees with a specific salary
What SQL statement can be used to fetch specific columns and rows from a database?
SELECT
statement
How can you sort employee details by first name in ascending order?
Using the ORDER BY
clause
What is the purpose of using the LIMIT
clause in a query?
To ensure only a specified number of rows are retrieved
What would the query SELECT * FROM employees WHERE salary = 8000
do?
Retrieve all employee details with a salary equal to 8000
What SQL function would you use to find the highest salary in a table?
MAX