What is Relational database?

A database that represents data as tables (relations) of rows and columns and relates tables to each other through shared values. Also called an RDB. Queries and updates are made in SQL, and constraints such as primary keys and foreign keys keep the data consistent.

Japanese name: 関係データベース

Relational database appears in 5 practice questions across 1 topic, including Database Basics.

Field: Database Basics

Tables, rows, columns and the relational model

A relational database is based on the relational model proposed by E. F. Codd in 1970. Data is represented as tables (relations); one row of a table is called a tuple, one column an attribute, and the set of values an attribute may take its domain. Tables are linked not by pointers but by shared values: an orders table, for example, has a cust_id column whose value identifies a row of the customer table. As a result, which tables to combine and under what conditions can be decided freely for each query.

Managing data with SQL and constraints

In a relational database, the SQL language is used to define tables (DDL), search and update data (DML) and control privileges (DCL). In SQL you only describe what result you want; the DBMS optimizer decides the order in which to read tables and which indexes to use. Data correctness is maintained by constraints, such as primary keys that uniquely identify rows, foreign keys that make rows refer correctly to rows of other tables, NOT NULL and UNIQUE that forbid NULL and duplicates, and CHECK that limits the range of values, together with the ACID properties of transactions.

Choosing between relational and other databases

Relational databases are widely used for business tasks such as inventory and accounting, where data consistency matters and searches combine many different conditions. Web services with very heavy traffic, on the other hand, sometimes use NoSQL databases such as key-value or document stores, which are easy to distribute across multiple servers. Rather than using only one kind, it is common to combine them according to purpose.

Try it: questions about Relational database

In relational database terminology, which term corresponds to one row of a table (relation)?

  1. ATuple
  2. BAttribute
  3. CDomain
Show answer and explanation

Answer: A. Tuple

A relational database represents data as tables (relations) made of rows and columns, and relates tables to each other through values. In the terminology of the relational model, one row of a table is a tuple, one column is an attribute, and the set of values an attribute may take is its domain. In an employee table, for example, the row holding one employee's data is a tuple, columns such as name and department are attributes, and the range of non-negative integers allowed in the age column is a domain. Because the relational model treats a table as a set of rows, the order of rows has no meaning and two completely identical rows are not allowed (in real SQL tables, identical rows can be stored if no primary key is defined).

In a relational database table, which condition must the column (or set of columns) designated as the primary key satisfy?

  1. AIts values must be numbers
  2. BIt must be the first column of the table
  3. CIts values must not be duplicated within the table and must not include NULL
Show answer and explanation

Answer: C. Its values must not be duplicated within the table and must not include NULL

A primary key is a column, or set of columns, used to uniquely identify one row in a table. Its values therefore must not duplicate those of any other row (uniqueness), and NULL, which represents an unknown value, is not allowed either (NOT NULL). When PRIMARY KEY is specified in an SQL CREATE TABLE statement, the DBMS (database management system) enforces these two constraints, and any operation that tries to insert a duplicate value or NULL fails with an error. A primary key may hold numbers such as employee numbers or character strings, and there is no rule about its column position. A minimal set of columns that can uniquely identify a row is called a candidate key, and the primary key is the one chosen from the candidate keys.

FAQ

What does "relational" in relational database refer to?

It refers to the tables themselves. In mathematics, a set of combinations of elements drawn from several sets is called a relation, and each row of a table corresponds to one such combination (a tuple). It does not mean the links between tables.

How do you choose between a relational database and NoSQL?

A relational database suits work where data consistency matters and complex searches such as table joins are common. NoSQL may suit cases with a very large number of simple reads and writes by key, where you want to scale out by distributing data across multiple servers.

Relational database in the explanations

Questions that mention Relational database (5)

  1. In relational database terminology, which term corresponds to one row of a table (relation)?
  2. In a relational database table, which condition must the column (or set of columns) designated as the primary key satisfy?
  3. Which correctly describes a database view in a relational database?
  4. What is the main purpose of normalization of tables in a relational database?
  5. In an E-R diagram, there is a many-to-many relationship between students and courses: one student takes several courses, and one course is taken by several students. Which is an appropriate way to implement this relationship with relational database tables?

Books on Database Basics Ad

As an Amazon Associate I earn from qualifying purchases.

Semiconductor, Electronics and Computing Calculators

Related terms

Primary key SQL Database view Database index Normalization E-R diagram Foreign key ACID properties Isolation level NoSQL

Back to the glossary