SQL Quick Guide

From SwinBrain

This page outlines the basic syntax for the SELECT, INSERT, UPDATE, and DELETE commands in SQL.

This page is a quick reference for this topic. SwinBrain and external links may provide more in depth details.
What The?
After some more details? Start by reading this database introduction.

Contents

SELECT Command

SELECT syntax:

SELECT (field1 [, field2] ...)
FROM (table1 [, table2] ...)
WHERE (condition1 [, condition2] ...)
ORDER BY (field1 [ASC|DESC] [, field2 [ASC|DESC]] ...)
GROUP BY (field1 [, field2] ...)
HAVING (condition1 [, condition2] ...)

Product related SELECT documentation: T-SQL | PL/SQL | MySQL

INSERT Command

INSERT syntax:

INSERT INTO table_name (field1 [, field2])
VALUES (value1 [,value2])

Product related INSERT documentation: T-SQL | PL/SQL | MySQL

UPDATE Command

UPDATE syntax:

UPDATE table_name 
SET field1 = (value1|expr1) 
 [, field2 = (value2|expr2)])
[WHERE (condition1 [, condition2])]

Product related UPDATE documentation: T-SQL | PL/SQL | MySQL

DELETE Command

DELETE syntax:

DELETE FROM table_name
[WHERE (condition1 [, condition2])]

Product related DELETE documentation: T-SQL | PL/SQL | MySQL

Links

SwinBrain Links: