Databases consist of sets of data. Tables are sets of structured data. Each βrowβ contains entries for one or more fields; each field is a specific type of data such as a string, integer, or date. One of the uses of databases is to connect tables based on shared fields. For an example see AppendixΒ A.
The most common method for accessing databases, especially large, enterprise databases, is Structured Query Language (SQL pronounced sequel). Below is a very simple illustration of the format of SQL query statements.
An example using the sample database is below that shows the major and department in which they work for every person that is both a student and an employee.
Note that the JOIN statements determine what set operation to perform on the tables. For example a left join takes all rows from the 1st table regardless of whether there is a matching row in the second table. For a left join from student to employee this would list all students whether or not they were also an employee. The employee fields would be null. An inner join requires that there be a matching row in both tables. For the example above this is all people who are both students and employees. An outer join uses all rows from both tables regardless of whether there is a match. This would include all people; student fields would be null for employees who never were a student and vice versa.