Payne's SQL Note #6

Back to Payne's SQL Notebook


WHERE, ORDER BY, UPDATE, DELETE

KeywordSyntaxExample
WHERESELECT column_name_1, column_name_2, ...
FROM table_name
WHERE column_name_a operator value AND/OR ...
SELECT *
FROM ReferenceTB
WHERE FirstAuthor='Chang PY'
ORDER BYSELECT column_name_1, column_name_2, ...
FROM table_name
ORDER BY column_name_a, column_name_b, ... ASC|DESC
SELECT *
FROM ReferenceTB
ORDER BY Year
UPDATEUPDATE table_name
SET column_name_1=value_1, column_name_2=value_2, ...
WHERE column_name_a=value_a AND/OR ...
UPDATE ReferenceTB
SET Title='Title Name'
WHERE FirstAuthor='Chang PY' AND Year=2012
DELETEDELETE
FROM table_name
WHERE column_name_1=value_1 AND/OR ...
DELETE
FROM ReferenceTB
WHERE Title='Title Name' AND Year=2012