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