The subject of relational databases and their query language SQL is huge and here we will only
give a very short summary. For more information see the references below.
Database design
In a relational database, information is stored in one or more tables (originally called "relations", hence the name).
Individual items are stored in rows in the table.
The information inside of a row is distributed over columns.
These columns are defined at the table level, i.e. all rows in a given table have the same columns,
though they need not all have values.
The definition of a table in terms of its columns is often called the schema of the table.
This term is also used for the definition of all tables and other objects in the database.
Structured Query Language, SQL
The most important feature of relational databases
for ordinary users that wish to access the stored information is the existence of a high-level
query language called SQL, sometimes pronounced as "sequel".
Views, functions and stored procedures
To ease the writing of queries one may add a number of objects to the schema besides tables.
Views are predefined SQL statements that have been bound to the database.
They can be used in ordinary SQL statements everywhere where a table can be used.
Here the fact is used that the result of an SQL query can itself be interpreted as a table.
There are many cases where a particular pattern is used over and over in SQL queries, and
then it makes sense to isolate this pattern as a separate SQL statement and store it as a view.
Similarly it may be useful to define functions and stored procedures on the database.
These are objects that can do calculations or other actions such as updates of the
database.
They may be used in SQL queries as well, but depending on their definition
they can occur anywhere in the statement. They may also be called outside of pure
SQL statements, depending on the interface the database vendor supplies.
Depending on the database also, these may be defined in a language different from SQL,
for example C or Java.
Tuning, indexes etc.
(TBD)
Vendors
The one problem with all of the preceeding is that there are no official standards,
well, there are, but the main popular relational database vendors do not conform
to the standards completely.
References
|