JDBC   «Prev  Next»
Lesson 4Relational Databases
Objective Explain the relational model.

JDBC and Relational Databases

Because understanding relational databases is crucial to understanding JBDC, this lesson will discuss them in more detail.
In the previous lesson, you were introduced to several terms associated with relational databases: tables, rows, and columns. The example below illustrates how they apply to the pieces of a database and what the table might look like.

Customer Number Name Address Phone Number Route Publication Account Current?
100 Smith, Joe 123 Main St 555-1000 1 The Times Yes
101 Doe, Jane 789 Dusty Rd 555-1234 2 Nightly News No

As illustrated above, the intersection of a row with a column represents a particular piece of information about a individual record. So, if your database is a collection of customer information, each customer might be represented by a row. The pieces of information you must keep about that customer (name, address, etc.) are in the separate fields or elements of that customer record represented by that row. The entire collection of customer records is held in a table.
As you add more customers you will add more rows. As the business grows, you will likely add more tables to help manage the extra information you need to track. Perhaps the number of customers increased to the point where one carrier can't deliver all our papers. You then hire more delivery people and keep track of them in another table such as the one described below.

Route Name Address Phone Number
1 Melville, Herman 1 Long St 555-9999
2 Joyce, James 10 Dublin Ln 555-0000

Information representation

This table format is a straightforward way to represent the information you want to preserve. It's convenient and it's often easy to cast your data into this form. There is another major advantage that comes with relational database systems. There is a standardized language for managing the data they hold. It isn't sufficient simply to have a handy way to store your information. You want to use it to help you run your business.
For example, you certainly will want a way to add and delete rows (records) from your table. You will also want some way to retrieve information from your individual tables. Further, if you keep information in several tables, you will likely want to perform queries that pull information together from several tables. Using the tables above, you may want to get a list of all the customers grouped by carrier name. To do that you would have to relate data from the first table to the second. SQL provides the mechanism to perform these operations.
More on the relational model can be found at Relational Model

SQL history

SQL was originally developed by Dr. E.F. Codd at IBM in the early 1970s.
It provides a rigorously defined method for managing sets of data and our database tables correspond to these data sets.
As you might suspect, there are variations and extensions to these basic operations. We will take the opportunity to explore them as we go along.
In the next lesson, SQL will be discussed.

JDBC architecture - Exercise


Click the Exercise link below to challenge your skills at describing your JDBC architecture.
JDBC Architecture - Exercise