Posts

Showing posts from January 16, 2011

MSSQL Statements Syntax

Select Statement Update Statement Insert Statement Delete Statement Select Into Statement Many times I forget the exact syntax I should use whether I'm writing in MSSQL, My-SQL or Oracle.  This post is the first out of three posts designed to gather basic database statements and show a simple and clean example to them. Select Statement: Syntax 1:  SELECT column_1, column_3                      FROM Table Example: SELECT ID, Name                 FROM tbl_customers Syntax 2: SELECT * FROM Table (meaning - select all columns). Example: SELECT * FROM tbl_customers Update Statement: Syntax 1: UPDATE Table                     column_1 = 'value' Example: UPDATE tbl_customers                     Name = 'Elad' This is a very bad example for UPDATE statement since this one will update -ALL- the names to 'Elad'. Syntax 2: UPDATE Table                     column_1 = 'value'                    WHERE column_2 = 'Dependen