A wildcard character. The _ means you can substitute any individual character here without breaking the pattern. The names Seven and Se7en both match this pattern.
Back
DEFAULT Constraint
Front
DEFAULT columns take an additional argument that will be the assumed value for an inserted row if the new row does not specify a value for that column.
----------------------------------------------------
award_name TEXT DEFAULT 'Grammy'
Back
%
Front
% is a wildcard character that matches zero or more missing letters in the pattern.
Back
Constraints
Front
Constraints add information about how a column can be used.
----------------------------------------------------
CREATE TABLE awards (
id INTEGER PRIMARY KEY,
recipient TEXT NOT NULL,
award_name TEXT DEFAULT 'Grammy'
);
Back
Restrict a query result
Front
WHERE clause filters the result set to only include rows where the following condition is true. You can compare values of two columns in a WHERE clause.
----------------------------------------------------
SELECT x, y
FROM coordinates
WHERE x > y;
Back
Statement
Front
A statement is a string of characters that the database recognizes as a valid command.
Back
Search for a specific pattern in a column
Front
LIKE is a special operator used with the WHERE clause to search for a specific pattern in a column. LIKE is not case sensitive.
----------------------------------------------------
SELECT *
FROM movies
WHERE name LIKE 'Se_en';
Back
AS
Front
AS is a keyword in SQL that allows you to rename a column or table using an alias. The new name can be anything you want as long as you put it inside of single quotes. The columns are not renamed in the table. The aliases only appear in the result.
----------------------------------------------------
SELECT name AS 'Titles'
FROM movies;
SELECT name AS 'title', year AS 'release_year'
FROM movies;
Back
Delete a row from a table
Front
DELETE FROM table
WHERE column condition;
Back
Table
Front
A table is a collection of data organized into rows and columns.
UNIQUE columns have a different value for every row. This is similar to PRIMARY KEY except a table can have many different UNIQUE columns.
----------------------------------------------------
recipient TEXT UNIQUE
Back
Comparison operators used with the WHERE
Front
= equal to
!= not equal to
> greater than
< less than
>= greater than or equal to
<= less than or equal to
Back
Add a new column to an existing table
Front
ALTER TABLE table
ADD COLUMN column data_type;
Back
DISTINCT
Front
DISTINCT is used to return unique values in the output. It filters out all duplicate values in the specified column(s). The DISTINCT clause can only be used once in the query and will apply only to the column immediately after it.
----------------------------------------------------
SELECT DISTINCT tools
FROM inventory;
Back
null
Front
A special value in SQL that represents missing or unknown data.
Back
Edit a row in a table
Front
UPDATE table
SET column = data
Back
PRIMARY KEY Constraint
Front
PRIMARY KEY columns can be used to uniquely identify the row. Attempts to insert a row with an identical value to a row already in the table will result in a constraint violation which will not allow you to insert the new row.
----------------------------------------------------
id INTEGER PRIMARY KEY
Back
Conditional clause to check if a value is null
Front
IS NULL
Back
Relational Database
Front
A relational database is a database that organizes information into one or more tables.
Back
Queries
Front
Queries allow us to communicate with the database by asking questions and having the result set return data relevant to the question.
Back
NOT NULL Constraint
Front
NOT NULL columns must have a value. Attempts to insert a row without a value for a NOT NULL column will result in a constraint violation and the new row will not be inserted.
----------------------------------------------------
recipient TEXT NOT NULL