SQL Guide : Getting started with SQL : The mathematical origins of SQL
  
The mathematical origins of SQL
Relational databases and SQL were originally based in part upon the mathematical concept of set theory. If you are familiar with set theory, it will help you understand how relational databases work. If you are not familiar with set theory, then do not worry about it; this is merely one way of looking at relational databases and SQL.
A table can be thought of as a mathematical set, where each element of the set is a row. (In our example above, each person, or composer, is an element of a set. The table contains all of the elements of the set “composers”.) In mathematics, sets are unordered. Similarly, in SQL, tables are largely treated as unordered, even though if you could look at the bits and bytes on the disk you would find that at any given time the records are stored in a particular order.
This lack of ordering is important, because it means that the results of a query may be shown in a different order each time that you run the query. With small data sets stored on a single disk drive, you will usually see the same rows in the same order each time, but this is not necessarily the case when data is spread across multiple files or disk drives.
Because SQL is a set-oriented language, you can use it to perform some set-oriented operations, such as UNIONs (that is, combining two sets of input into one set of output). However, operations such as UNION require that the sets match each other - that is, that they have the same number of columns, and that they have the same data type (or compatible data type) in corresponding columns. You can not perform a UNION operation if the first column in set1 is of type DATETIME and the first column in set2 is INTEGER, for example.
Again, if you are not comfortable with set theory, do not worry about it. This is just another way of looking at relational databases.
See also
Getting started with SQL