FlashKeepers

SQL · SQL · College and University

SQL Fundamentals

Core SQL statement types (SELECT, INSERT, UPDATE, DELETE) and clause syntax explained with a short example query each.

About this set

42 basic cards for SQL SQL. It opens with "What is the basic syntax for a SELECT statement?" and "How do you filter rows in a SELECT with a WHERE clause?". More College and University decks are listed below.

42 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What is the basic syntax for a SELECT statement?
Show answerSELECT column1, column2 FROM table_name
How do you filter rows in a SELECT with a WHERE clause?
Show answerSELECT * FROM users WHERE age > 18
What does the ORDER BY clause do?
Show answerSorts the result set by one or more columns: SELECT * FROM products ORDER BY price DESC
What is the LIMIT clause used for?
Show answerRestricts the number of rows returned: SELECT * FROM orders LIMIT 10
What does DISTINCT do in a SELECT?
Show answerReturns only unique values: SELECT DISTINCT country FROM customers
How do you count rows with an aggregate function?
Show answerSELECT COUNT(*) FROM employees
What does the SUM aggregate function do?
Show answerAdds up all values in a column: SELECT SUM(salary) FROM employees
How do you find the average value in a column?
Show answerSELECT AVG(price) FROM items
What does the MAX function return?
Show answerThe highest value in a column: SELECT MAX(score) FROM games
What does the MIN function return?
Show answerThe lowest value in a column: SELECT MIN(salary) FROM employees
What is the GROUP BY clause used for?
Show answerGroups rows by one or more columns: SELECT department, COUNT(*) FROM employees GROUP BY department
How do you filter groups after GROUP BY?
Show answerUse HAVING: SELECT department, COUNT(*) FROM employees GROUP BY department HAVING COUNT(*) > 5
What is an INNER JOIN?
Show answerReturns rows with matching values in both tables: SELECT * FROM orders INNER JOIN customers ON orders.customer_id = customers.id
What is a LEFT JOIN?
Show answerReturns all rows from left table and matching rows from right: SELECT * FROM customers LEFT JOIN orders ON customers.id = orders.customer_id
What is a RIGHT JOIN?
Show answerReturns all rows from right table and matching rows from left: SELECT * FROM orders RIGHT JOIN customers ON orders.customer_id = customers.id

27 more cards in the app

Study this set free