Wróć do informacji o e-podręczniku Wydrukuj Pobierz materiał do PDF Pobierz materiał do EPUB Pobierz materiał do MOBI Zaloguj się, aby dodać do ulubionych Zaloguj się, aby skopiować i edytować materiał Zaloguj się, aby udostępnić materiał Zaloguj się, aby dodać całą stronę do teczki
RFNXVfwQQPS4J

Introduction to databases

Source: licencja: CC 0.

Wprowadzenie do baz danych

You will learn
  • the classification of databases,

  • the terms: a record, a field, a primary and foreign keys,

  • what data types are accepted by databases.

RrlD5hVcYSDEX1
nagranie abstraktu

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.

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 recordrecordrecord, a fieldfieldfield and a primary keyprimary keyprimary key.

Data are stored in tables. A database can contain multiple tables. The tabletabletable 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 keyprimary key is a unique field throughout a table that clearly identifies a given record.

RmRCLN1X8Oojk
Ilustracja interaktywna przedstawia schemat dwóch przykładowych tabel w bazie danych. Wybrane elementy schematu zostały oznaczone numerami od 1 do 5. Pierwsza tabela students (nazwa tabeli oznaczona numerem 1) ma pola: id_student (pole oznaczone numerem 3), last_name, first_name, birthday, address, id_class (pole oznaczone numerem 5). Druga tabela class (nazwa tabeli oznaczona numerem 2) ma pola: id_class (pole oznaczone numerem 4), name, school_year. Obok pól id_student oraz id_class znajdują się ikony przypominające klucze. Pole id_class w tabeli class jest symbolicznie połączone z polem id_class w tabeli students. Na numerach widoczne są podpisy. 1. The name of a table. {audio}, 2. The name of a table. {audio}, 3. A primary key. {audio}, 4. A primary key. {audio}, 5. A foreign key. {audio}.
The exemplary tables in a database
Source: GroMar, licencja: CC BY 3.0.
Task 1
RoC74bxeHXlcu1
nagranie abstraktu

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 tabletabletable.

Task 2
R1S6KQaTpKtRs1
nagranie abstraktu

What are the data types of the fields in the tables presented in the illustration above?

R15zAFEhFGH1s
nagranie abstraktu
The types of databases

Simple databases:

  • file databasefile databasefile database is a database based on a single file, usually a text file; it can store data for particular applications or devices.

  • flat‑file databaseflat‑file databaseflat‑file database is a database in which every table is a single document and is not related to the other table.

  • hierarchical databasehierarchical databasehierarchical database is a database in which each recordrecordrecord, 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.

RuURs0hOmZLzP
nagranie abstraktu

Complex databases:

  • relational databaserelational databaserelational database is a database in which multiple tables are linked with one another with the so called relations.

  • An object databaseobject databaseobject database is a database which stores a set of objects along with the properties assigned to them.

  • temporal databasetemporal 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.

RqRswM9Kf5lhV
nagranie abstraktu

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 recordrecordrecord but analyse data from numerous records.

RPO88tXyxzMiE
nagranie abstraktu

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.

RGuPGPUY3wZQO
nagranie abstraktu

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.

RBXH8AsZIkfgy1
nagranie abstraktu

When you create the names of fields in a database tabletabletable, avoid names including spaces and the Polish diacritics.

Task 3
R13kuhQp3gRXu1
nagranie abstraktu

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.

Task 4
RJAddliTrg37d1
nagranie abstraktu

Open the database designed by you in the database programme installed on your computer. Fill it with fictional data.

R1HSwsZCdgv1X1
nagranie abstraktu

Currently databases are applied almost in every fieldfieldfield of our life.

Exercises

RThWe1SPogyrg
Exercise 1
Wersja alternatywna ćwiczenia: Determine which sentences are true. Możliwe odpowiedzi: 1. A file database is a based on a single text file., 2. A flat-file database is a based on tables that are linked with one another. , 3. A relational database may contain multiple tables that are linked with one another with the so called relations., 4. An object database stores a set of objects along with the properties assigned to them., 5. A hierarchical database is similar to the structure of directories and files.
zadanie
Source: GroMar, licencja: CC BY 3.0.
Exercise 2

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.

Exercise 3

On the internet find the information about any programme for designing databases. Describe shortly in English its basic features and application.

R1P3UeDhoSJWa
Exercise 4
Wersja alternatywna ćwiczenia: Indicate which pairs of expressions or words are translated correctly. Możliwe odpowiedzi: 1. baza danych - database, 2. tabela - table, 3. relacja - relation, 4. klucz podstawowy - primary key, 5. klucz obcy - field, 6. rekord - object database
zadanie
Source: GroMar, licencja: CC BY 3.0.
R1Hbo4hLhrWbZ1
Interaktywna gra, polegająca na łączeniu wyrazów w pary w ciągu jednej minuty. Czas zaczyna upływać wraz z rozpoczęciem gry. Jeden ruch to odkrywanie najpierw jednej potem drugiej karty z wyrazem. Każdy wyraz jest odczytywany. Kolejny ruch to odkrywanie trzeciej i czwartej karty. W ten sposób odsłuchasz wszystkie wyrazy. Nawigacja z poziomu klawiatury za pomocą strzałek, odsłuchiwanie wyrazów enterem lub spacją. Znajdź wszystkie pary wyrazów.
Source: Zespół autorski Politechniki Łódzkiej, licencja: CC BY 3.0.

Glossary

data type
data type

typ danych

R10dICvIgboj91
wymowa w języku angielskim: data type
database
database

baza danych

R1S2rRmrphx271
wymowa w języku angielskim: database
field
field

pole

RxYH504i9ib3R1
wymowa w języku angielskim: field
file database
file database

baza plikowa

R9Rds4A701ucN1
wymowa w języku angielskim: file database
flat‑file database
flat‑file database

baza kartotekowa

RFHhJwzFIE8l81
wymowa w języku angielskim: flat‑file database
foreign key
foreign key

klucz obcy

R1bcZ4c4qYjqp1
wymowa w języku angielskim: foreign key
hierarchical database
hierarchical database

baza hierarchiczna

Rgp4t8pMMeHx91
wymowa w języku angielskim: hierarchical database
object database
object database

baza obiektowa

Rrg8R1TDUHTwr1
wymowa w języku angielskim: object database
primary key
primary key

klucz podstawowy

RngMAbyvOgLoB1
wymowa w języku angielskim: primary key
record
record

rekord

R1W0GkCPWlCh61
wymowa w języku angielskim: record
relation
relation

relacja

R1Et25BcdUWVb1
wymowa w języku angielskim: relation
relational database
relational database

baza relacyjna

R1YFPEuFJksih1
wymowa w języku angielskim: relational database
table
table

tabela

R66d9qbAlw5HF1
wymowa w języku angielskim: table
temporal database
temporal database

temporalna baza danych

R1chElSBUHKMR1
wymowa w języku angielskim: temporal database

Keywords

databasedatabasedatabase

primary keyprimary keyprimary key

relationrelationrelation

tabletabletable