Simple Queries

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

Extract All Tuples

All Tuples and All Attributes

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

  1. SELECT * FROM table-name;

All Tuples with a Subset of Attributes

  1. 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.

  1. SELECT * FROM table-name WHERE condition;

Subset of Attributes

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

Sorting the Results

  1. SELECT * FROM table-name WHERE condition ORDER BY attr-list;
  July 4, 2026 at 06:32 AM