Java Reference
In-Depth Information
item of interest. Table 9-1 shows an example relational table that stores information about
employees.
taBle 9-1: Employee Relational Table
employeeid
name
gender
dnr
1
Bart Baesens
Male
1
2
Aimée Backiel
Female
1
3
Seppe vanden
Broucke
Male
1
4
Michael Jackson
Male
2
5
Sarah Adams
Female
3
The table has four columns, also called attribute types, which specify the employee characteristics
that should be stored. The first attribute type, EmployeeID, is called the primary key and is unique
for each employee. The table has five rows, which are also called tuples. Conceptually, a relational
database table corresponds to a mathematical set, which implies that every row is unique and there
are no duplicate rows. Every row consists of a series of values, whereby every value comes from a
specific type (integer, text, date, and so on) or can also be NULL, which means that the value is
unknown or not applicable. The last column, DNR, is a foreign key that refers to the department
number in the table Department, which is defined as shown in Table 9-2.
taBle 9-2: Department Relational Table
dnr
dname
daddress
1
ICT
Brussels
2
Marketing
New York
3
Finance
Singapore
4
Accounting
Sydney
Note that by using foreign keys, relationships can be established between various tables. As such,
it can be easily seen that in the example, employees Bart Baesens, Aimée Backiel, and Seppe
vanden Broucke work in ICT, whereas Michael Jackson works in Marketing and Sarah Adams
in Finance.
RDBMSs use structured query language (SQL) as the underlying language to both define and
manipulate the database concepts. In fact, SQL has a subset of instructions to define data structures,
called data definition language (DDL), as well as to manipulate data, called data manipulation
language (DML). SQL is a declarative language. Hence, as discussed in Chapter 1, you need only
to specify which data to retrieve, in contrast to procedural languages, where you have to explicitly
declare how to retrieve the data.
Search WWH ::




Custom Search