Difference between revisions of "SQL statement examples"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
(etc)
(etc)
Line 6: Line 6:
  
 
* SELECT statements return zero or more records
 
* SELECT statements return zero or more records
* INSERT statements insert a new record
+
* INSERT INTO statements insert a new record
 
* UPDATE statements update existing records
 
* UPDATE statements update existing records
 
* DELETE statements delete existing records
 
* DELETE statements delete existing records
Line 20: Line 20:
  
  
=== INSERT statements ===
+
=== INSERT INTO statements ===
  
INSERT statements insert a new record into a database table.
+
INSERT INTO statements insert a new record into a database table.
  
  
Line 42: Line 42:
  
 
* [http://www.w3schools.com/sql/sql_select.asp SQL SELECT] @ W3Schools
 
* [http://www.w3schools.com/sql/sql_select.asp SQL SELECT] @ W3Schools
* [ SQL INSERT] @ W3Schools
+
* [http://www.w3schools.com/sql/sql_insert.asp SQL INSERT INTO] @ W3Schools
* [ SQL UPDATE] @ W3Schools
+
* [http://www.w3schools.com/sql/sql_update.asp SQL UPDATE] @ W3Schools
* [ SQL DELETE] @ W3Schools
+
* [http://www.w3schools.com/sql/sql_delete.asp SQL DELETE] @ W3Schools

Revision as of 09:21, 23 July 2015

This article demonstrates a variety of SQL statements.

Overview

SQL statements, broadly speaking, fall into four commonly used categories:

  • SELECT statements return zero or more records
  • INSERT INTO statements insert a new record
  • UPDATE statements update existing records
  • DELETE statements delete existing records

Case insensitivity

SQL statements are typically case-insensitive. These examples follow the common convention of uppercasing SQL keywords.

SELECT statements

SELECT statement return zero or more records.


INSERT INTO statements

INSERT INTO statements insert a new record into a database table.


UPDATE statements

UPDATE statements update zero or more existing records in a database table.


DELETE statements

DELETE statements delete zero or more existing records from a database table.


Different implementations of SQL

Note that different implementations of SQL -- different "flavors" -- may differ in their details. The examples on this page are appropriate to a wide range -- but not necessarily all -- implementations.

External links