The Open SQL statement for reading data from database tables is:
SELECT
INTO
FROM
The SELECT statement is divided into a series of simple clauses, each of which has a different part to play in selecting, placing, and arranging the data from the database.
Clause | Description |
SELECT | The SELECT clause defines the structure of the data you want to read, that is, whether one line or several, which columns you want to read, and whether identical entries are acceptable or not. |
INTO | The INTO clause determines the target area |
FROM | The FROM clause specifies the database table or view |
WHERE | The WHERE clause specifies which lines are to be read by specifying conditions for the selection. |
GROUP BY | The GROUP-BY clause produces a single line of results from groups of several lines. A group is a set of lines with identical values for each column listed in |
HAVING | The HAVING clause sets logical conditions for the lines combined using GROUP BY. |
ORDER BY | The ORDER-BY clause defines a sequence |
The individual clauses and the ways in which they combine are all very important factors in the SELECT statement. Although it is a single statement like any other, beginning with the SELECT keyword and ending with a period, its division into clauses, and the ways in which they combine, make it more powerful than other statements. A single SELECT statement can perform functions ranging from simply reading a single line to executing a very complicated database query.
You can use SELECT statements in the WHERE and HAVING clauses. These are called subqueries.
You can decouple the INTO clause from the SELECT statement by reading from the database using a cursor.
On certain database systems, locking conflicts can also occur when only reading the data. These can be avoided by using database commits.
No comments:
Post a Comment