Home - HighKingOfGondor/Relational_Database_Management_System GitHub Wiki

Welcome to the Relational_Database_Management_System wiki!

In a nutshell

This database implements the core functions of a simple database management system (DBMS).

Part I: Specification of the DBMS

Database management systems are very complex pieces of software. They support concurrent use of a database, transactions, permission handling, query optimizations, logging, you name it. To be efficient, they utilize highly tuned algorithms developed over the course of decades. This DBMS is based on relational algebra, and only implement and ANTLR parser and the DB engine (which responds to queries). This database system does not have network implantation, sockets or secure login and queries (e.g., using a TLS library), and so on, which is beyond the general point of my project.
Relational algebra is a formal system for manipulating relations.
It consists of only six primitive operations. Each of the operations takes relations as arguments, and produces a relation as a result. The operations thus compose freely. The upside of using relational algebra is that the implementation effort of the DBMS stays manageable. The downside is that queries tend to be more verbose and maybe a bit harder to construct than, say, with "real" SQL.

Terminology:

Database
a collection of relations
Relation
a table with columns and rows
Attribute
a named column of a relation
Domain
the set of admissible values for one or more attributes
Tuple
a row of a relation (sequence of values, one for each attribute of a relation)

Relational algebra

The six operations of (that is, the core of) relational algebra are:

  1. Selection: select the tuples in a relation that satisfy a particular condition.
  2. Projection: select a subset of the attributes in a relation.
  3. Renaming: rename the attributes in a relation.
  4. Set union: compute the union of two relations; the relations must be union-compatible.
  5. Set difference: compute the set difference of two relations; the relations must be union-compatible.
  6. Cross product: compute the Cartesian product of two relations.
  7. Natural join: compute the combination of all tuples in two relations, say, R & S, which are equal on their common attribute names. The common attributes only appear once in the result.