Introduction to databases
the classification of databases,
the terms: a record, a field, a primary and foreign keys,
what data types are accepted by databases.
It is worth to realise that databases are synonymous with storing huge amounts of data. Modern databases collect for instance the photographs of the universe, information about flights and plane passengers all over the world, the descriptions of medicines and their applications. It would be difficult to store such information traditionally, in a notebook or even in a file. Even if you had enough sheets of paper, finding needed information would be simply impossible. For comparison, a single modern personal computer can contain information written on over 20 million sheets of paper.
A database is a set of organized data associated with a specific issue.
Basically a database can be treated as a tool for:
storing,
browsing,
searching,
sorting information.
The basic terms related to databases are: a table, a recordrecord, a fieldfield and a primary keyprimary key.
Data are stored in tables. A database can contain multiple tables. The tabletable must have its unique name in the database. The table is made up of fields, which correspond to columns in a spreadsheet, and data are collected in rows, which are called records. The records, contrary to the spreadsheet, are not assigned the row numbers and can be entered into the table in any order. All data values are based on simple data types. A primary keyprimary key is a unique field throughout a table that clearly identifies a given record.
On the internet or in the Help menu of the database programme installed on your computer find what data types can be accepted by the fields in a tabletable.
What are the data types of the fields in the tables presented in the illustration above?
The types of databases
Simple databases:
A file databasefile database is a database based on a single file, usually a text file; it can store data for particular applications or devices.
A flat‑file databaseflat‑file database is a database in which every table is a single document and is not related to the other table.
A hierarchical databasehierarchical database is a database in which each recordrecord, except from the root record, is linked to only one parent record. Data are organized into a tree‑like structure, similar to the structure of directories and files.
Complex databases:
A relational databaserelational database is a database in which multiple tables are linked with one another with the so called relations.
An object databaseobject database is a database which stores a set of objects along with the properties assigned to them.
A temporal databasetemporal database is a variation of a relational database in which every record has got a timestamp, which defines the time in which a given value is true. Temporal databases enable storing the entire history of all data.
XML is a data structure based on the markup language. Many databases can import data from the XML file or export data to such a file. Some programming languages enable operating on data directly in XML files.
The classification of databases by their reach:
local databases,
databases operating based on the client- server model,
centralised databases – databases stored on a single server,
distributed databases – databases stored on multiple servers,
data warehouses – databases that collect huge amounts of data, which may come from multiple systems. Such databases do not focus on a single recordrecord but analyse data from numerous records.
Database design
Creating databases should be preceded by their design. In order to design a good database, you must pay attention to the following issues:
functionality according to assumptions,
removing data redundancy (duplicating data),
full data integrity (all data are consistent),
the scalability (easy expansion) of a database,
the security of collected data.
In the case of large databases the design process is crucial and unfortunately it is difficult to implement due to the specialised knowledge needed.
Table design
The data types in a single column should be identical and defined already at the stage of the table design. Various programmes may accept slightly different data types. However all of them enable storing text, numbers, dates and time, currencies, multimedia elements, links, etc. The names of fields, similar to tables, should be unique.
When you create the names of fields in a database tabletable, avoid names including spaces and the Polish diacritics.
Design a database made up of one table including information about the students who play voleyball at a school club. The design should include:
the name of the table,
the names of the fields and the specification of data types,
identifying primary keys.
Open the database designed by you in the database programme installed on your computer. Fill it with fictional data.
Currently databases are applied almost in every fieldfield of our life.
Exercises
Determine which sentences are true.
- A file database is a based on a single text file.
- A flat-file database is a based on tables that are linked with one another.
- A relational database may contain multiple tables that are linked with one another with the so called relations.
- An object database stores a set of objects along with the properties assigned to them.
- A hierarchical database is similar to the structure of directories and files.
Design a database for a video games rental consisting of two tables. The design should include:
- the names of the tables,
- the names of the fields and specifying data types,
- identifying primary and foreign keys.
On the internet find the information about any programme for designing databases. Describe shortly in English its basic features and application.
Indicate which pairs of expressions or words are translated correctly.
- baza danych - database
- tabela - table
- relacja - relation
- klucz podstawowy - primary key
- klucz obcy - field
- rekord - object database
- field
- database
- klucz podstawowy
- pole
- baza danych
- tabela
- relacja
- table
- primary key
- relation
Glossary
typ danych
Nagranie dostępne na portalu epodreczniki.pl
wymowa w języku angielskim: data type
baza danych
Nagranie dostępne na portalu epodreczniki.pl
wymowa w języku angielskim: database
pole
Nagranie dostępne na portalu epodreczniki.pl
wymowa w języku angielskim: field
baza plikowa
Nagranie dostępne na portalu epodreczniki.pl
wymowa w języku angielskim: file database
baza kartotekowa
Nagranie dostępne na portalu epodreczniki.pl
wymowa w języku angielskim: flat‑file database
klucz obcy
Nagranie dostępne na portalu epodreczniki.pl
wymowa w języku angielskim: foreign key
baza hierarchiczna
Nagranie dostępne na portalu epodreczniki.pl
wymowa w języku angielskim: hierarchical database
baza obiektowa
Nagranie dostępne na portalu epodreczniki.pl
wymowa w języku angielskim: object database
klucz podstawowy
Nagranie dostępne na portalu epodreczniki.pl
wymowa w języku angielskim: primary key
rekord
Nagranie dostępne na portalu epodreczniki.pl
wymowa w języku angielskim: record
relacja
Nagranie dostępne na portalu epodreczniki.pl
wymowa w języku angielskim: relation
baza relacyjna
Nagranie dostępne na portalu epodreczniki.pl
wymowa w języku angielskim: relational database
tabela
Nagranie dostępne na portalu epodreczniki.pl
wymowa w języku angielskim: table
temporalna baza danych
Nagranie dostępne na portalu epodreczniki.pl
wymowa w języku angielskim: temporal database
Keywords
databasedatabase
primary keyprimary key
relationrelation
tabletable