A result set is a set of data selected from a database and stored in a result table. Result tables consist of rows and columns with criteria depending on the query executed.
Basic SQL Select Syntax
A very basic query will select all rows containing all specified columns from the database table.
SQL Select Syntax With Conditions
To limit the results of a select query the where clause can be used. All rows will be returned that satisfy the conditions of the where clause used.
where column_one = 'condition' or column_two > 'condition' and column_three < 'condition'
Here is a very simple database table which holds information about people. The table is called Person. The table has only four rows and four columns to keep things simple in the examples.
Example SQL Queries
The following SQL statement will select all rows of only first_name and city columns from the Person table.
The following SQL statement will select all rows of only first_name and last_name columns from the Person table. However, rows will only appear in the dataset if the person's state is California.
where state = 'California'