SQL SQL MOC


Databases store data. There are two types of databases depending on how they store data.

Relational Databases

Relational databases structure data storage in tables with a fixed maximum size. Relational database tables can be related together based on primary and foreign keys. Each table must have a primary key, typically a unique ID for each row. Foreign keys store the primary keys of another table.

customerIdfirstNamelastNameaddresscitycountry
1UrsaVasquezP.O. Box 878, 8416 Nullam St.WorcesterUnited States
2QuynMeyerP.O. Box 670, 7155 Tincidunt St.PriceCanada
3OrliKlein4981 Gravida St.Barrow-in-FurnessUnited Kingdom
4TallulahHines6279 Pellentesque StreetOmahaUnited States
5JoelRossP.O. Box 842, 4634 Egestas AvenueClovenfordsUnited Kingdom
6CharlotteRamos794-1654 A Rd.AkronUnited States
7DennisAveryP.O. Box 506, 4804 Molestie AvenueMatlockUnited Kingdom
8IgorMalone6627 Porttitor Rd.IrvineUnited Kingdom
9ConnorWitt5979 Vel St.TainUnited Kingdom
10KarenMarquezAp 524-1173 Metus. RoadAnnapolis RoyalCanada
orderIddatecurrencytotalcustomerId
12020-11-14$1116
22020-07-07£9584
32021-02-18£7212
42020-05-25$8344
52020-07-10£471
62021-02-27£5874
72021-03-04£19810
82020-09-03$2003
92020-11-17£7263
102020-12-29$2005
In this table, orderId is the primary key and customerId is a foreign key.

Non-relational Databases

Non-relational databases hold unstructured data for ambiguous data types. These databases are also called NoSQL databases because they don’t use SQL.

This type of database can be useful for data like log messages, since they vary from system to system with varying types and message size.