SQL Flashcards
functions and tags
What does the SELECT statement do in SQL?
The SELECT statement retrieves data from a database.
What is the purpose of the WHERE clause?
The WHERE clause filters records that meet specified conditions.
How do you use the INSERT INTO statement?
The INSERT INTO statement is used to add new records to a table.
What does the UPDATE statement do?
The UPDATE statement modifies existing records in a table.
What is the function of the DELETE statement?
The DELETE statement removes existing records from a table.
Explain the JOIN clause.
The JOIN clause combines rows from two or more tables based on a related column.
What does the INNER JOIN do?
The INNER JOIN returns records that have matching values in both tables.
What is a LEFT JOIN?
The LEFT JOIN returns all records from the left table and matched records from the right table.
Describe the RIGHT JOIN
The RIGHT JOIN returns all records from the right table and matched records from the left table.
What is a FULL OUTER JOIN?
The FULL OUTER JOIN returns all records when there is a match in either left or right table
What is the purpose of the GROUP BY clause?
The GROUP BY clause groups rows that have the same values in specified columns.
How does the HAVING clause work?
The HAVING clause filters groups based on specified conditions
What does the ORDER BY clause do?
The ORDER BY clause sorts the result set in ascending or descending order.
Explain the use of the LIMIT clause.
The LIMIT clause restricts the number of rows returned by a query.
What does the DISTINCT keyword do?
The DISTINCT keyword removes duplicate records from the result set.
What is the function of the COUNT() function?
The COUNT() function returns the number of rows that match a specified criterion.
How is the SUM() function used?
The SUM() function calculates the total sum of a numeric column.
What does the AVG() function do?
The AVG() function calculates the average value of a numeric column.
Describe the MIN() function.
The MIN() function returns the smallest value in a specified column.
What is the purpose of the MAX() function?