SQL commands Flashcards
SELECT
Query info from a database
AS
rename column or table
DISTINCT
return unique values
WHERE
filter results based on specified condition
LIKE
use with WHERE
match closely matching names using wildcard characters
BETWEEN
use with WHERE
return results within a range.
Numbers: includes 2nd condition
Text: includes first specified character in 2nd condition
AND
use with WHERE
meets all conditions
OR
use with WHERE
meets any condition
ORDER BY
sorts results
ASC: default
DESC: high to low, Z-A
LIMIT
specifies number of rows to return
always at end of query
CASE
if-then conditional
CASE
WHEN … THEN …
ELSE …
END
CREATE TABLE
creates a new table
INSERT INTO
adds a new row to a table
ALTER TABLE
edits table column(s)
UPDATE
edits table row(s)