next up previous contents index
Next: Creating Tables Up: Basic SQL Commands Previous: Basic SQL Commands

  
Relational Databases

As mentioned in Section [*], the purpose of a database is rapid data storage and retrieval. Today, most database systems are relational databases . While the term ``relational database'' has a mathematical foundation, in practice it means that all data stored in the database is arranged in a uniform structure.

Figure [*] shows a database server with access to three databases: demo, finance, and test.

\resizebox*{!}{0.3\textheight}{\includegraphics{databases.eps}}

You could issue the command psql finance and be connected to the finance database. You have already dealt with this issue in Chapter [*]. Using psql, you chose to connect to database test with the command psql test. To see a list of databases available at your site, type psql -l. The first column lists the database names. However, you may not have permission to connect to all of them.

You might ask, ``What are those black rectangles in the databases?'' They are tables. Tables are the foundation of a relational database management system (RDBMS) . They hold the data stored in a database. Each table has a name defined by the person who created it.

Let's look at a single table called friend shown in Table [*].

 
Table: Table friend
FirstName LastName City State Age
Mike Nichols Tampa FL 19
Cindy Anderson Denver CO 23
Sam Jackson Allentown PA 22


You can readily see how tables are used to store data. Each friend is listed as a separate row in the table. The table records five pieces of information about each friend: firstname, lastname, city, state, and age.8.1

Each friend appears on a separate row; each column contains the same type of information. This is the type of structure that makes relational databases successful. It allows you to select certain rows of data, certain columns of data, or certain cells. You could select the entire row for Mike, the entire column for City, or a specific cell like Denver.

Some synonyms exist for the terms ``table,'' ``row,'' and ``column.'' ``Table'' is more formally referred to as a relation or class, ``row'' as record or tuple, and ``column'' as field or attribute. 


next up previous contents index
Next: Creating Tables Up: Basic SQL Commands Previous: Basic SQL Commands
Bruce Momjian
2001-05-09