SQL: Queries, Joins & Aggregates
74 cards · 🇺🇸 English
SELECT queries, joins, and aggregate functions in SQL.
Study all 74 cards for free
Flashcards, quizzes, pixel-art games and a daily review that remembers for you.
Try the first 10 cards
1 / 10SQL
Tap the card for the answer · swipe right if you knew it, left if not
Already have an account? Sign in
Cards
- 1SQLStructured Query Language
- 2Is SQL case-sensitive?Keywords are not case-sensitive, but data may be (depends on DBMS and collation settings)
- 3Four main SQL sublanguagesDQL (Data Query Language), DDL (Data Definition Language), DML (Data Manipulation Language), DCL (Data Control Language)
- 4SELECT statementA query used to retrieve data from one or more tables
- 5Syntax for a basic SELECT querySELECT column1, column2 FROM table_name;
- 6Select all columns from a tableSELECT * FROM table_name;
- 7WHERE clauseFilters rows based on specified conditions
- 8Syntax for WHERESELECT * FROM table_name WHERE condition;
- 9What operators can be used in WHERE?=, !=, <, >, <=, >=, AND, OR, NOT, LIKE, IN, BETWEEN, IS NULL
- 10LIKEPattern matching using wildcards (% for any characters, _ for single character)
- 11INChecks if a value matches any value in a list: WHERE country IN ('USA', 'Canada')
- 12BETWEENSelects values within a range (inclusive): WHERE age BETWEEN 20 AND 30
- 13NULL in SQLA marker indicating absence of value (not equal to 0 or empty string)
- 14Check for NULL valuesUse IS NULL or IS NOT NULL (not = NULL)
- 15Why can't you use = NULL?NULL represents unknown, and any comparison with NULL returns NULL (not true or false)
- 16ORDER BYSorts query results by one or more columns
- 17Default order for ORDER BYASC (ascending)
- 18Sort in descending orderUse DESC: ORDER BY column_name DESC
- 19DISTINCTRemoves duplicate rows from the result set
- 20Syntax for DISTINCTSELECT DISTINCT column_name FROM table_name;
- 21LIMITRestricts the number of rows returned (syntax varies by DBMS: LIMIT in MySQL, TOP in SQL Server)
- 22INNER JOINReturns only rows where there is a match in both tables
- 23Syntax for INNER JOINSELECT * FROM table1 INNER JOIN table2 ON table1.id = table2.id;
- 24LEFT JOINReturns all rows from the left table and matched rows from the right table (NULL for non-matches)
- 25LEFT JOIN vs LEFT OUTER JOINThey are the same - OUTER is optional
- 26RIGHT JOINReturns all rows from the right table and matched rows from the left table (NULL for non-matches)
- 27FULL JOIN (FULL OUTER JOIN)Returns all rows when there is a match in either left or right table (NULL for non-matches on either side)
- 28CROSS JOINReturns the Cartesian product of both tables (every row of table1 with every row of table2)
- 29Self-joinJoining a table to itself (uses aliases to differentiate the same table)
- 30COUNT()Returns the number of rows that match a specified condition
And 44 more cards. Study the whole deck free
Articles about this deck
More Programming decks
See all- 🗄️
SQL : requêtes, jointures et agrégats
74 cards · 🇺🇸 English
Requêtes SELECT, jointures et fonctions d'agrégation en SQL.
- 🗄️
SQL: Consultas, Joins y Funciones de Agregación
74 cards · 🇺🇸 English
Consultas SELECT, joins y funciones de agregación en SQL.
- 🗂️
SQL: Database Design & Normalization
32 cards · 🇺🇸 English
Schema design, keys, and normal forms for relational databases.
- 🗄️
SQL: Abfragen, Joins & Aggregatfunktionen
74 cards · 🇺🇸 English
SELECT-Abfragen, Joins und Aggregatfunktionen in SQL.
- 🍃
NoSQL: MongoDB & Redis Basics
36 cards · 🇺🇸 English
Core document-store and key-value store concepts with MongoDB and Redis.
- 🗂️
SQL: Diseño de Bases de Datos y Normalización
32 cards · 🇺🇸 English
Diseño de esquemas, claves y formas normales para bases de datos relacionales.
