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

Operations on a database

Source: licencja: CC 0.

Operacje na bazie danych

You will learn
  • what a Database Management System is,

  • what SQL is and what its purpose is,

  • how to insert data into a database,

  • how to modify existing data in a database,

  • how to delete data from a database,

  • how to search a table in a database,

  • how to sort a table.

RDIkBTbIDNhUy
Ilustracja interaktywna przedstawia schemat systemu bazodanowego. Elementy schematu zostały oznaczone numerami od 1 do 8. W centrum znajduje się rysunek przypominający walec obrazujący bazę danych (oznaczony numerem 1). Baza danych łączy się z dużym prostokątem (oznaczonym numerem 2), razem otoczone są zaznaczeniem (oznaczonym numerem 3). Od prostokąta poprowadzone są strzałki z grotami w dwóch kierunkach do mniejszych prostokątów (oznaczonymi numerami 4, 5, 6). Wszystkie opisane elementy otoczone są prostokątem (oznaczonym numerem 7). Po zewnętrznej stronie prostokąta znajdują się postacie ludzi (oznaczone numerem 8). Na numerach widoczne są podpisy. 1. a database {audio}, 2. a Database Management System {audio}, 3. a database system {audio}, 4. an application {audio}, 5. an application {audio}, 6. an application {audio}, 7. a computer system {audio}, 8. users {audio}.
A Database Management System (DBMS)
Source: GroMar, licencja: CC BY 3.0.
R1NcFOgdZOXzn1
nagranie abstraktu

Database Management System (DBMS) is a programme or an entire computer system used for managing a database. Apart from ensuring access to data in the database, it enables performing many operations that are necessary to ensure the correct operation of the database, such as: administrationadministrationadministration, ensuring security, optimisingoptimisingoptimising, reportingreportingreporting or a range of additional mechanisms.

Task 1
R1TtTbd2nPKiD1
nagranie abstraktu

On the Internet, find popular Database Management Systems.

R2pvNavbxU0G71
nagranie abstraktu

Structured Query Language (SQL) is a language used for creatingcreatingcreating and modifyingmodifyingmodifying databases and for insertinginsertinginserting and retrieving data from databases. It enables performing the following basic operations:

  • creating and modifying databases,

  • creating, modifying and deletingdeletingdeleting tables,

  • inserting, modifying and deleting data in tables,

  • searchingsearchingsearching for data in tables (queries).

Most database programmes installed on desktop computers include mechanisms that enable performing these operations without knowledge of the SQL syntaxSQL syntaxSQL syntax.

R2Fg9E595cuEX1
nagranie abstraktu

The easiest method of insertinginsertinginserting data into a database is importing the data from the existing data sources directly to tables in the database.

The INSERT statement in SQL is used to insert data into a database table.

Task 2
RsPZEk7owOakn1
nagranie abstraktu

Download the file and import the file with the data to a database.

R1bqlsJwV9Llq1
Plik z danymi do pobrania
Source: Zespół autorski Politechniki Łódzkiej <e-podreczniki@p.lodz.pl>, licencja: CC BY 3.0.
R1XELhsqQLKSO
Importing data in MS Access
Source: GroMar, licencja: CC BY 3.0.
RUt6Gd7NZv2TQ1
nagranie abstraktu

In the resulting table you will find the information about the books: their author, title and the year of their first edition. Add five records with your favourite books.

RIH5xSQZF8WbU1
nagranie abstraktu

ModifyingmodifyingModifying data refers to changing the content of fields in existing records. To modify (update) data in SQL you must use the UPDATE statement.

Task 3
Rg9M2N8Dt5sng1
nagranie abstraktu

In the table from the previous task change the data in a selected record.

R1IHlRyZFl9NW1
nagranie abstraktu

DeletingdeletingDeleting data refers to removing an entire record or a group of records in a table. To delete data in SQL you must use the DELETE statement.

Task 4
RFPAnlB3hgtCP1
nagranie abstraktu

In the table from the previous task, delete two selected records.

RdThlq5HI9jCu1
nagranie abstraktu

One of the operations performed the most frequently on databases is searchingsearchingsearching for data. A statement in SQL that realises queries to a database is the SELECT statement.

Task 5
RRrmfG1iG30oY1
nagranie abstraktu

In the table from the previous task, find the books meeting the following criteria:

  • issued after 2010,

  • the Author field begins with the letter ‘C’,

  • in the Title field, the second letter is ‘i’ .

If you have problems with the task, see the solution.

R139aVFj3fxrL1
Source: GroMar, licencja: CC BY 3.0.
R15n8P1NpTeqX1
nagranie abstraktu

Data in the form of records are entered into the tables of a database in an unorganized way. To order them, we usually sort a selected column of the table in an ascending or descending order. A statement in SQL that realises sortingsortingsorting tables is the SELECT statement together with the ORDER BY statement. It performs sorting data, while its parameters defining the sort order are: ASCin an ascending orderin an ascending orderin an ascending order (alphabetically) and DESCin a descending orderin a descending orderin a descending order.

Task 6
R1T7GbF0wR0sG1
nagranie abstraktu

In the table from the previous task, sort the books from the one issued the least recently.

If you have problems with the task, see the solution.

RE8ssgILKuvAd1
Source: GroMar, licencja: CC BY 3.0.
RPLA3ywuLM36w1
nagranie abstraktu

Databases are used for storing truly huge amounts of data. Thanks to them you can easily search for needed information and modify it.

Exercises

RJDHv2fzzgOsO
Exercise 1
Wersja alternatywna ćwiczenia: Identify true statements of SQL: Możliwe odpowiedzi: 1. SELECT, 2. ORDER BY, 3. SORT BY , 4. INSERT, 5. UPDATE, 6. MODIFY
zadanie
Source: GroMar, licencja: CC BY 3.0.
Exercise 2

In the database you worked on during the lesson perform the following operations:

  • find the books issued last year,

  • find the book titles which contain the word ‘the’,

  • sort the records in the table in a descending order by the Title field,

  • sort the records in the table in an ascending order by the Title and Author fields.

Exercise 3

Consider what database would be useful to you on an everyday basis. Why? Design the needed tables.

R1ME5jWFFcAlt
Exercise 4
Wersja alternatywna ćwiczenia: Indicate which pairs of expressions or words are translated correctly. Możliwe odpowiedzi: 1. administrowanie - administration, 2. optymalizacja - optimising, 3. raportowanie - reporting, 4. składnia języka SQL - SQL syntax, 5. wprowadzanie - searching, 6. wyszukiwanie - inserting
zadanie
Source: GroMar, licencja: CC BY 3.0.
R5OcCmikMr4dK1
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

administration
administration

administrowanie

R1H6OdXQ8pT061
wymowa w języku angielskim: administration
creating
creating

tworzenie

RW1CjZ4L7ZkW71
wymowa w języku angielskim: creating
Database Management System, DBMS
Database Management System, DBMS

System zarządzania bazą danych, SZBD

R15DIvFUf6k861
wymowa w języku angielskim: Database Management System, DBMS
deleting
deleting

usuwanie

RdXBCDcTgUBqd1
wymowa w języku angielskim: deleting
in a descending order
in a descending order

malejąco

Ru2vvPFEWuGKq1
wymowa w języku angielskim: in a descending order
in an ascending order
in an ascending order

rosnąco

R1OgmE6B3HjiT1
wymowa w języku angielskim: in an ascending order
inserting
inserting

wprowadzanie

RNihsQlYKoEGy1
wymowa w języku angielskim: inserting
modifying
modifying

modyfikowanie

RSgN2eKB2PQYu1
wymowa w języku angielskim: modifying
optimising
optimising

optymalizacja

R18v9dxDJHXhC1
wymowa w języku angielskim: optimising
reporting
reporting

raportowanie

RADYb2071krGO1
wymowa w języku angielskim: reporting
searching
searching

wyszukiwanie

RT3Tun0DRQyjX1
wymowa w języku angielskim: searching
sorting
sorting

sortowanie

RaPHMab5WGDM31
wymowa w języku angielskim: sorting
SQL syntax
SQL syntax

składnia języka SQL

R1N89BtCNsmox1
wymowa w języku angielskim: SQL syntax

Keywords

administrationadministrationadministration

Database Management System, DBMSDatabase Management System, DBMSDatabase Management System, DBMS

optimisingoptimisingoptimising

reportingreportingreporting

SQL syntaxSQL syntaxSQL syntax