SQL Reference

 

Simple Queries

SQL ReferenceQuery Conditions

The SELECT statement performs queries on a relational database and is the most common used SQL command. The result is stored in a result table.

Extract All Tuples

All Tuples and All Attributes

Extract all data in the table which includes all rows and columns.

   SELECT * FROM table-name;

All Tuples with a Subset of Attributes

   SELECT attr1, attr2, ..., attrN FROM table-name;

Extract a Subset of Tuples

All Attributes

Extract a subset of tuples from the table where each tuple includes all of the attributes.

   SELECT * FROM table-name WHERE condition;

Subset of Attributes

   SELECT attr1, attr2, ..., attrN FROM table-name WHERE condition;

Sorting the Results

   SELECT * FROM table-name WHERE condition ORDER BY attr-list;



SQL ReferenceQuery Conditions
Print -- Recent Changes
Page last modified on February 18, 2014, at 12:10 PM