The relational database was invented in 1970 by E. F. Codd, then a young programmer at IBM. In his paper, "A Relational Model of Data for Large Shared Data Banks," Codd proposed shifting from storing data in hierarchical or navigational structures to organizing data in tables containing rows and columns.
Each table, which is sometimes called a relation, in a relational database contains one or more data categories in columns, also called attributes. Each row, also called a record or tuple, contains a unique instance of data, or key, for the categories defined by the columns. Each table has a unique primary key, which identifies the information in a table. The relationship between tables can then be set via the use of foreign keys -- a field in a table that links to the primary key of another table.
For example, a typical business order entry database would include a table that described a customer with columns for name, address, phone number and so forth. Another table would describe an order: product, customer, date, sales price and so forth. A user of a relational database can then obtain a view of the database to fit their needs. For example, a branch office manager might like a view or report on all customers that bought products after a certain date. A financial services manager in the same company could, from the same tables, obtain a report on accounts that need to be paid.
When creating a relational database, you can define the domain of possible values in a data column and further constraints that may apply to that data value. For example, a domain of possible customers could allow up to 10 possible customer names but be constrained in one table to allowing only three of these customer names to be specifiable. Two constraints relate to data integrity and the primary and foreign keys:
Entity integrity ensures that the primary key in a table is unique and that the value is not set to null.
Referential integrity requires that every value in a foreign key column will be found in the primary key of the table from which it originated.
Types of databases
There are a number of database categories, from basic flat files that aren't relational to NoSQL to newer graph databases that are considered even more relational than standard relational databases.
A flat file database consists of a single table of data that has no interrelation -- typically text files. This type of file enables users to specify data attributes, such as columns and data types.