diff options
| author | alex <alex@pdp7.net> | 2025-02-23 10:49:44 +0100 |
|---|---|---|
| committer | alexpdp7 <alex@corcoles.net> | 2025-02-23 10:50:52 +0100 |
| commit | d28f8c4deaed592999047d5bfdd7641c284c19d8 (patch) | |
| tree | 69f95c3292b6c4b4005640d1abaceb2e85158e10 /programming | |
| parent | 07ac46a90ee79ca0bf78e35c5406f6a8dafc8528 (diff) | |
Add programming/about_relational_databases
Diffstat (limited to 'programming')
| -rw-r--r-- | programming/about_relational_databases.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/programming/about_relational_databases.md b/programming/about_relational_databases.md new file mode 100644 index 00000000..464de330 --- /dev/null +++ b/programming/about_relational_databases.md @@ -0,0 +1,30 @@ +# About relational databases + +## What is a relation? + +A common misconception is that the "relations" in a relational database are about relations between database tables. + +Actually, the relations in a relational database are the tables. + +A relation "relates" a set of values with another set of values. + +For example, a relation can relate the name of a person with their birth date and birth place. +For example: + +``` +(person name) => (birth date, birth place) +(Alice) => (1979-12-03, Barcelona) +(Bob) => (1995-03-04, Paris) +... +``` + +Many computer languages have similar concepts: + +* [Python mapping types such as `dict`](https://docs.python.org/3/library/stdtypes.html#mapping-types-dict) +* C++ `std::map` +* Java `java.util.Map` +* [C# `System.Collections.Generic.Dictionary`](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2?view=net-9.0) +* [Javascript `Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) +* [PHP arrays](https://www.php.net/manual/en/language.types.array.php) + +Relations are a natural concept, so although non-relational data systems exist, most data can be stored as relations. |
