Databases Flashcards
What is a database?
A database is a large collection of data items and links between them, structured in a way that allows it to be accessed by a number of different application programs.
The term is also used loosely to describe any collection of data.
What is a Database Table?
A table is the name for each group of similar data with rows for each instance of an entity and columns for each attribute.
What is a Record?
“[A] Record is the basic unit of data stored in a data file. It is a collection of data items, which may be of different data types, all relating to the individual or object that the record describes and is treated as a unit for processing.”
A record is really a row of data from a database table.
What is a key field?
“[A] Key is the field within a record used to identify the record.”
What is a Field?
[A] Field is part of a record designed to hold a single data item of a specified type.
A record is really a column of data from a database table.
What is a primary key?
A field that uniquely identifies an individual record in a table can be chosen as the Primary Key of the table.
What is a composite key?
A composite key is one that consists of two or more fields
What is a foreign key?
When the primary key from one table appears as a field in a second table, it is known as a Foreign Key of the second table.
Explain how relationships are used in databases.
The way relationships are represented in a relational database involves the use of primary and foreign keys. If the primary key of one table appears as a foreign key in a second table, then we say that there is a relationship or a link between the two tables.
We can see which individual athletes are related to which individual events by cross referencing the values in the respective foreign and primary key fields
Definition of a data type
“[A] data type is a formal description of the kind of data being stored or manipulated within a program or system, for example CHAR (N), REAL or DATE
Explain the data type - CHAR(N)
CHAR(N) is string data type, whose values are constrained to have exactly N
characters. For example the following are all CHAR(4): “Fred”, “Fre ”, “Fr d”, “1234”.
Explain the data type - TEXT
TEXT is a string data type, whose values may have a variable numer of characters.
For example: “Fred”, Fre”, “Fr”, “F”, “Fred12345”.
Explain the data type - ENUM
ENUM is a string data type, whose values are constrained to be one of a list of
permitted values
Explain the data type -INT
INT is a numeric data type that can store whole numbers – which may be either
positive or negative. For example: 0, 1, 2, -99.
Explain the data type - REAL
REAL is a numeric data type that can store numbers with decimal places. For example:
1, 2.718, 3.141, -2.718, -3.141