Skip to content

Relation, Schema, and Attribute ​

This page brings together the basic terms of relational DBs (relation, tuple, attribute, domain), the rules of a relation, the 3-level schema and data independence, and how attributes are classified.

What Is a Relation? (Tuple/Attribute/Domain) ​

A relation can be thought of as a table made of rows and columns. Picturing an Excel sheet makes it easy.

        [Attribute] (column)
         Name     Age   Dept
Tuple →  Chulsoo  28    Dev Team
(row)    Younghee 31    Planning Team

Structure of a relation: tuple, attribute, domain

  • Tuple = one row. In file terms, it is one line of a record.
  • Attribute = one column. It is the smallest logical unit that makes up a database.
  • Domain = the type and range of values an attribute can have. For example, the domain of the "age" column is "integers 0 or greater." The DB uses this domain to block invalid values (e.g. age = "abc") from coming in.

There are also separate terms for counting.

TermMeaningIn Excel terms
CardinalityNumber of tuplesNumber of rows
DegreeNumber of attributesNumber of columns

Since data keeps piling up and getting deleted, the contents of a relation change over time. So relations are discussed in two parts.

  • Relation schema: "which columns make up this table" (the frame, the blueprint)
  • Relation instance: the data actually filling that frame (its contents at this moment)

Cardinality changes constantly as rows come and go, but the degree stays the same unless you change the table design (schema).

Rules a Relation Must Follow ​

Although it looks similar to an Excel sheet, a relation has a few rules.

  1. The same tuple (row) cannot appear twice. That is why you need a key to tell rows apart.
  2. Tuples have no order. The idea of row 1 and row 2 doesn't originally exist.
  3. Attributes (columns) have no order either. Whether the name column or the age column comes first, it is the same relation.
  4. Attribute names must not overlap, but values may. There can't be two "age" columns, but several people can be 28.
  5. Each cell holds only one value that cannot be split further (an atomic value). This rule comes back later in normalization (1NF).
  6. As tuples come in and get deleted, a relation keeps changing over time.

Several Names for the Same Thing ​

The same concept is called different things in relational DB theory, practical SQL, and file systems. Exams also just swap the names, so it is easier to remember them as a group.

Relational DB theoryPractice (SQL)File system
RelationTableFile
TupleRowRecord
AttributeColumnField

Terms with the same meaning

The 3-Level Schema and Data Independence ​

The ANSI/SPARC 3-level schema is a structure for showing one database in different forms depending on who is looking. Here is a building analogy.

External schema   →  "the screen I use"              (application/user view)
Conceptual schema →  "the whole building blueprint"  (logical structure of the whole organization)
Internal schema   →  "the actual concrete/plumbing"  (physical storage method)

ANSI/SPARC 3-level schema structure

  • External schema: the view seen by an individual user or application. It sees only the part of the organization's data it needs.
  • Conceptual schema: the overall data structure shared by all applications. Access rights, security, and integrity rules are also included here.
  • Internal schema: how data is actually stored on disk (record format, storage order, etc.).

The three levels are connected to each other through mappings. When one level changes, the DBMS only fixes this connection information, so the level above is not affected. This is called data independence.

  • External/conceptual mapping: connects the screens (views) users see with the actual tables. → guarantees logical data independence

  • Conceptual/internal mapping: connects the actual tables with the disk storage method. → guarantees physical data independence

  • Logical data independence: even if the conceptual schema changes, the external schema doesn't. For example, adding a column to a table doesn't require fixing existing screens/code.

  • Physical data independence: even if the internal schema changes, the conceptual schema doesn't. For example, adding a new index for query speed or switching storage to an SSD leaves our table definitions and SQL statements unchanged.

In short, this 3-level structure is a design to prevent situations where "one screen changed, so the whole storage method has to be torn apart and rebuilt."

How it shows up on exams

  • If you see phrases like "the view of the whole organization" or "only one exists in the DB," the answer is the conceptual schema.
  • What independence does the conceptual/internal mapping guarantee? Physical data independence.
  • The external schema is also called the subschema, and the conceptual schema is sometimes just called the schema.

How Attributes Are Classified ​

Even "columns" can be divided into a few kinds depending on their nature.

By Origin ​

  • Basic attribute: an original attribute that comes naturally from the business (name, date of birth, etc.)
  • Designed attribute: an attribute not in the business but newly created because the design needed it (e.g. product code)
  • Derived attribute: an attribute made by calculating from other attributes (e.g. age can be calculated from date of birth, total amount is unit price × quantity)

By Role in the Table ​

  • PK attribute: acts as the identifier that distinguishes rows
  • FK attribute: points to another table (foreign key)
  • General attribute: any other pure data value

By Whether the Value Can Be Split ​

This classification is especially important because it ties directly into normalization, which comes next.

  • Simple attribute: a single value that can't be split further (age, gender)
  • Composite attribute: a value that splits into several sub-attributes (address → city/province, district, neighborhood/unit number)
  • Multivalued attribute: an attribute where one cell can hold several values (hobbies → soccer, movies, reading)

A multivalued attribute crams several values into a single table cell, so leaving it as is makes searching/updating hard. So it is usually split into a separate table at the modeling stage, and this rule of "only one value per cell" is the key condition of 1NF, which comes later.

Derived Attributes Are Convenient but Tricky to Manage ​

A derived attribute (e.g. total amount = unit price × quantity) is stored in advance instead of being calculated every time, so queries get faster. In exchange, it has to be updated together every time the original values (unit price, quantity) change, and if you forget, the values stop matching each other. So it is used only where truly needed.

How it shows up on exams

  • Among [employee name, unit price, quantity, total amount], which one is different in nature? Total amount (the only derived attribute)
  • "Derived attributes improve query performance, but care is needed to keep data consistent" → This is true.
  • An attribute that wasn't originally in the business but was created as a code or serial number for the system is a designed attribute.

Summary ​

ConceptKey point
RelationA table made of rows and columns. Tuple (row), attribute (column), domain (type and range of values)
Cardinality / degreeNumber of tuples / number of attributes
Schema / instanceThe frame (blueprint) / the data filling it right now
Relation rulesNo duplicate rows, no row or column order, one atomic value per cell
Names with the same meaningRelation = table = file, tuple = row = record, attribute = column = field
3-level schemaExternal (user screen), conceptual (overall logical structure), internal (physical storage)
Data independenceLogical: external stays when conceptual changes / physical: conceptual stays when internal changes
Attribute classificationOrigin (basic/designed/derived), role (PK/FK/general), splittable (simple/composite/multivalued)

Reference: personal Notion study notes