Skip to content

Datenbanken & Informationssysteme

import DriveAsset from ’../../../../components/DriveAsset.astro’;


The foundational operators in relational algebra:

OperatorSymbolMeaningExample
Selectionσφ(R)\sigma_\varphi(R)Rows satisfying predicate φ\varphiσcredits≥6(Course)\sigma_{\text{credits} \ge 6}(\text{Course})
ProjectionπA1,…,Ak(R)\pi_{A_1, \dots, A_k}(R)Select specific columnsπname, matnr(Student)\pi_{\text{name, matnr}}(\text{Student})
Natural JoinR⋈SR \bowtie SJoin on matching attribute namesStudent⋈Enrollment\text{Student} \bowtie \text{Enrollment}
Theta JoinR⋈θSR \bowtie_\theta SGeneral condition joinR⋈R.A<S.BSR \bowtie_{R.A < S.B} S
RenameρS(R)\rho_{S}(R)Renames relation or attributesρAlumni(Graduates)\rho_{\text{Alumni}}(\text{Graduates})

Retrieve all students enrolled in “Datenbanken” with a grade ≤2.0\le 2.0:

πname, matnr(σtitle=’Datenbanken’∧grade≤2.0(Student⋈Exam⋈Course))\pi_{\text{name, matnr}}\left( \sigma_{\text{title} = \text{'Datenbanken'} \land \text{grade} \le 2.0} (\text{Student} \bowtie \text{Exam} \bowtie \text{Course}) \right)
# docker-compose.yml for local database lab
version: '3.8'
services:
postgres-db:
image: postgres:16-alpine
container_name: uni_postgres
restart: always
environment:
POSTGRES_USER: uni_user
POSTGRES_PASSWORD: secretpassword
POSTGRES_DB: university_vault
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata: