You are on page 1of 11

LIS 384K.

11 Database-Management Principles and Applications


Tables and Their Components
R. E. Wyllys
Copyright 2002 by R. E. Wyllys Last revised 2002 Jan 28

GSLIS - The University of Texas at Austin LIS 384K.11, Database-Management Principles and Applications

Types of Keys1

1For

Superkey Candidate Key Primary Key Secondary Key Foreign Key

a detailed discussion of keys, see the Course Note entitled Key Concepts.

GSLIS - The University of Texas at Austin LIS 384K.11, Database-Management Principles and Applications

Types of Keys
Superkey
A key (i.e., a column or combination of columns containing no null values and no duplicate values) that identifies each row uniquely.

Candidate Key
For Rob and Coronel, a minimal superkey (i.e., a superkey with no subsets that are themselves superkeys) For most writers, any superkey (i.e., any key that identifies each row uniquely) Note: Most writers equate "candidate keys" and "superkeys", and use only the term "candidate keys"

GSLIS - The University of Texas at Austin LIS 384K.11, Database-Management Principles and Applications

Types of Keys
Primary Key
The candidate key (superkey) that has been selected as the preferred key for identifying records in a particular table Provides a unique way to identify each record Can be obvious from the structure of the table. If there is no easy natural choice, you can add a column containing a unique identifier. May consist of one or more columns; multiple columns need not be adjacent
A single-column key is called a simple key A multiple-column key is called a composite key

May consist of the entire record (especially with two-column tables, which occur often in the development of RDBs)

GSLIS - The University of Texas at Austin LIS 384K.11, Database-Management Principles and Applications

Types of Keys
Secondary Key
A column that is used to aid in the retrieval of information from a table. A secondary key is not required to have unique values in each of its rows,

Foreign Key
A column that is used to aid in the retrieval of information from one table (i.e., is a secondary key) and that is also the primary key in another table. Foreign keys are a major tool in RDBs. Because of referential integrity, a foreign key should have only values that occur in the table in which it is the primary key. All foreign keys are secondary keys, but not all secondary keys are foreign keys.
GSLIS - The University of Texas at Austin LIS 384K.11, Database-Management Principles and Applications

Types of Fields
Character Numeric Logical Image Object LBO (Large Binary Object)

GSLIS - The University of Texas at Austin LIS 384K.11, Database-Management Principles and Applications

Types of Fields
Character: Alphanumeric and punctuation. Character fields can include numerals, but calculations cannot be performed on the contents of the field even though they look like numbers.
Examples: Names, product codes, SSNs, ZIPCodes Sometimes further differentiated between memo fields (short) and text fields (long)

GSLIS - The University of Texas at Austin LIS 384K.11, Database-Management Principles and Applications

Types of Fields
Numeric: Arithmetic operations can be performed on the contents of the field
Numbers (sometimes further differentiated among integers [short, long], fixed-decimal point numbers, floating-point numbers) Dates (addition and subtraction only)

GSLIS - The University of Texas at Austin LIS 384K.11, Database-Management Principles and Applications

Types of Fields
General Rule for Numeric Fields: Never assign a field a numeric data type unless you intend to perform mathematical calculations on its contents.

GSLIS - The University of Texas at Austin LIS 384K.11, Database-Management Principles and Applications

Types of Fields
Logical: True-False (T, F), Boolean (0, 1), Yes-No (Y, N) Image: Used for relatively small graphics files (e.g., under 100KB) Object: An object is a package of data together with program code that performs certain functions on the data Large Binary Object: Used for very large items, such as multi-megabyte graphic, audio, and video files; the RDB typically merely stores pointers to the locations of these large files
GSLIS - The University of Texas at Austin LIS 384K.11, Database-Management Principles and Applications

The World is Full of Files

GSLIS - The University of Texas at Austin LIS 384K.11, Database-Management Principles and Applications

You might also like