🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Technology & Design › Web & Software Development › SQL and PostgreSQL Database Development › Lesson 1
TEC-WEB46-04 · Lesson 1 · 11.5 clock hours · theory

Relational Database Concepts and the PostgreSQL Environment

Objective. Students will explain the relational model, identify the components of a DBMS, and successfully install and connect to a local PostgreSQL instance.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

What Is a Relational Database?

A relational database organizes data into tables—formally called relations—where every piece of information has a precise location defined by a row and a column. The model was described by E.F. Codd in 1970 and remains the dominant approach for storing structured data in web and software applications today.

Each table represents one category of data, such as `users`, `orders`, or `products`. A single row in a table is called a tuple; it represents one record. A single column is called an attribute; it describes one property of every record in the table. For example, a `users` table might have attributes like `user_id`, `email`, and `created_at`.

Keys and Relationships

Relational databases stay consistent through keys. A primary key is a column (or set of columns) whose value uniquely identifies every tuple in a table—no two rows may share the same primary key value, and it may never be NULL. A foreign key is a column in one table that references the primary key of another table, creating a relationship between the two. If a row in `orders` contains a `user_id` column that points to the `users` table, that `user_id` is a foreign key. This link is how relational databases avoid repeating the same customer name and address inside every order record.

Enforcing these keys is part of what a database management system does automatically, preventing orphan records and keeping data accurate across an entire application.

The Database Management System (DBMS)

A DBMS is the software layer that sits between raw data files on disk and the applications or people who need that data. It handles reading, writing, searching, securing, and recovering data. A relational DBMS (RDBMS) specifically implements the relational model and responds to queries written in SQL (Structured Query Language).

Every RDBMS has several core components:

Schemas and Catalogs

A schema is a named namespace inside a database that groups related tables, views, and other objects together. In PostgreSQL the default schema is called `public`. A large web application might place tables used by the billing module in a `billing` schema and tables used by the authentication module in an `auth` schema, keeping everything organized and reducing naming conflicts.

The catalog is where PostgreSQL itself stores its own data about the database—essentially a database about the database. In PostgreSQL this lives in the `pg_catalog` schema. You will query it indirectly every time you run `\d` in psql to describe a table.

PostgreSQL Architecture

PostgreSQL uses a multi-process architecture. When the server starts, a master process called postmaster listens for incoming connections. For each client connection it forks a separate backend process dedicated to that session. Shared memory holds buffers that all backend processes read from and write to, coordinating through a set of background utility processes responsible for tasks like writing data to disk (the background writer), managing transaction IDs (autovacuum), and archiving logs.

Data is stored in a directory called the data cluster, typically referenced by the environment variable `PGDATA`. Inside it you will find subdirectories for each database, configuration files, and the write-ahead log (WAL), which records every change before it is applied to the main data files—protecting against data loss if the system crashes.

Installing PostgreSQL and Connecting

On a Linux lab workstation you install PostgreSQL through the package manager for your distribution. On Windows you use the graphical installer from the PostgreSQL project website. During installation you set a password for the built-in superuser account named postgres.

After installation you will edit pg_hba.conf (the host-based authentication configuration file) to control how clients authenticate. For a local development environment, setting the authentication method for local connections to `trust` allows any local OS user to connect without a password—convenient for lab work, but never appropriate for a production or internet-facing server.

You can connect in two ways:

1. psql — the command-line client. Run `psql -U postgres` to open an interactive SQL session. Type `\l` to list databases and `\q` to quit.

2. pgAdmin 4 — a graphical tool that lets you browse objects, run queries, and view data through a web-based interface running in your browser.

Safety and Good Practices

Database work does not involve electrical or physical hazards typical of other trades, but it carries its own risks:

Key terms10

RelationA table in a relational database; a two-dimensional structure of rows and columns that represents one category of data.
TupleA single row in a relation; represents one complete record with values for each attribute.
AttributeA column in a relation; describes one property shared by every record in the table.
Primary KeyA column or set of columns whose values uniquely identify every tuple in a table; must be unique and not NULL.
Foreign KeyA column in one table that references the primary key of another table, establishing a relationship between the two tables.
DBMSDatabase Management System; software that stores, retrieves, secures, and manages data on behalf of applications and users.
SchemaA named namespace inside a database that groups related tables, views, and other objects to keep them organized.
CatalogInternal system tables maintained by the DBMS that store metadata about all database objects such as tables, columns, and indexes.
pg_hba.confThe PostgreSQL host-based authentication configuration file that controls which users and hosts may connect and how they must authenticate.
postmasterThe master PostgreSQL server process that listens for client connections and forks a dedicated backend process for each session.
In class: Read and annotate the PostgreSQL 16 official documentation sections covering architecture, processes, and data storage; answer a guided reading worksheet with 15 factual questions. · Install PostgreSQL on a lab workstation, configure pg_hba.conf for local trust authentication, and connect via both psql and pgAdmin, documenting each step in a lab notebook. · Complete a concept-mapping exercise that links terms—relation, tuple, attribute, primary key, foreign key, DBMS, schema, catalog—to their definitions and real-world analogies from web applications.
Materials: PostgreSQL 16 Community Documentation, lab workstations (Linux or Windows), pgAdmin 4, psql CLI, instructor slide deck, guided reading worksheet
Check: Students answer 10 oral or written identification questions covering relational model vocabulary and can demonstrate a live psql connection; pass = 8/10 correct.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

CompTIA ITF+ — IT Concepts and Terminology
1. In the relational model, the formal term for a single row in a table is:
CompTIA ITF+ — IT Concepts and Terminology
2. Which component of a DBMS stores metadata such as the names of tables, their columns, and their data types?
CompTIA ITF+ — IT Concepts and Terminology
3. A `user_id` column in an `orders` table that references the `users` table's primary key is an example of a:
CompTIA Linux+ — System Management
4. In PostgreSQL's multi-process architecture, which process listens for incoming client connections and forks a new backend for each one?
CompTIA Linux+ — Security
5. Which PostgreSQL configuration file controls whether clients authenticate with a password, a certificate, or no credential at all?
CompTIA Linux+ — Security
6. Setting the authentication method to `trust` in pg_hba.conf means that:
CompTIA Linux+ — System Management
7. Which psql meta-command lists all databases available on the connected PostgreSQL server?
CompTIA ITF+ — IT Concepts and Terminology
8. A web application's database is organized so that tables used by billing are in a `billing` namespace and tables used by authentication are in an `auth` namespace. These namespaces are called:
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.