4.5 Databases (SQL) Flashcards
(9 cards)
Select Data
Retrieving specifc columns from a table
SELECT column1, column2 FROM table_name;
Select With Condition
Retrives all columns from a table where the specified column is true
SELECT * FROM table_name WHERE condition;
Create Table
Creates a new table with specified columns and data types
CREATE TABLE table_name ( column1 datatype, column2 datatype );
Insert Data
Adds new rows od data into a table
INSERT INTO table_name (column1, column2) VALUES (value1, values2);
Update Data
Modifies existing data in a table
UPDATE table_name SET column1 = value1 WHERE condition;
Select With Condition on Numeric Values
Retrieves specific columns from a table where a numeric condition is met
SELECT column1, column2 FROM table_name WHERE numeric_column < value;
Select With Multiple Conditions
Retrieves specific columns from table where multiple conditions are met
SELECT column1, column2 FROM table_name WHERE condition1 AND condition2
Select with OR Condition
Retrieves specific columns from table where at least 1 condition is met
SELECT column1, column2 FROM table_name WHERE condition1 OR condition2
Subquery
Uses a nested query to retrive data based on result of another query.
SELECT column1, column2 FROM table_name WHERE column = ( SELECT column FROM table_name WHERE condition );