Explore tens of thousands of sets crafted by our community.
SQL Basics
30
Flashcards
0/30
VARCHAR
Defines a variable-length string data type. Used for columns that contain letters and numbers in a database.
SELECT
Retrieves data from one or more tables. Used to query the database and get specific records.
AUTO_INCREMENT
A database feature that automatically generates a unique number for the primary key field in a table. Used to create a unique identifier for new rows with minimal manual input.
WHERE
Filters records based on specified conditions. Used to narrow down the results returned from a SELECT, UPDATE or DELETE command.
GROUP BY
Groups rows sharing a property so that an aggregate function can be applied to each group. Commonly used in conjunction with aggregate functions like COUNT, MAX, MIN, SUM, AVG.
LEFT JOIN
Returns all records from the left table and the matched records from the right table. The result is NULL from the right side if there is no match.
PRIMARY KEY
A constraint that uniquely identifies each record in a database table. Used to ensure that every row has a unique value and is not null.
NOT NULL
A constraint that ensures that a column cannot have a NULL value. Used to enforce data integrity by ensuring that specific columns always contain a value.
CASE
Allows for condition-based logic within an SQL query. Used for creating different outputs based on conditions.
DROP TABLE
Removes a table from the database. Used to delete a table and all of its data permanently.
FOREIGN KEY
A constraint that creates a link between two tables. Used to establish and enforce a link between the data in two tables to control the data that can be stored in the foreign key table.
INT
Defines an integer data type. Used for columns that store whole numbers (both positive and negative).
FULL OUTER JOIN
Returns all records when there is a match in either left or right table. Those not matching will have NULL values for every column of the table with no match.
DELETE
Removes records from a table. Used to delete data from a database.
ORDER BY
Sorts the result-set by one or more columns. Used to organize output data either in ascending or descending order.
UNION ALL
Combines the result sets of two or more SELECT statements. Used when wanting to return all records (including duplicates) from multiple tables.
NULL
Represents a missing or unknown value in a database. Used in columns where data is optional or not available.
CREATE TABLE
Creates a new table in the database. Allows the specification of columns and their data types.
HAVING
Filters records that work on summarized GROUP BY results. Used when an aggregate condition has to be applied after data is grouped.
UPDATE
Modifies existing records in a table. Used to change data within a table.
RIGHT JOIN
Returns all records from the right table and the matched records from the left table. The result is NULL from the left side if there is no match.
INDEX
Creates a database index on one or more columns. Used to speed up the retrieval of data by creating a data structure that improves data access times.
INNER JOIN
Returns records that have matching values in both tables. Used to select rows from two or more tables that satisfy the join condition.
IN
Specifies multiple possible values for a column. Used within a WHERE clause to filter results according to a list of values.
JOIN
Combines rows from two or more tables based on a related column. Used to merge rows from different tables with a common key.
DISTINCT
Removes duplicate records from the results of a SELECT query. Used when unique records are required from a column or set of columns.
CROSS JOIN
Produces a Cartesian product of the two tables. Used to join every row of one table with every row of another table.
INSERT INTO
Adds a new row to a table. Used to add a new record to a table in the database.
ALTER TABLE
Modifies the structure of an existing table. Used to add, delete, or modify columns in a table.
UNION
Combines the result sets of two or more SELECT statements. Used when wanting to return all records (no duplicates) from multiple tables.
© Hypatia.Tech. 2024 All rights reserved.