Data is stored in tables. Every entry corresponds to a row.
SQL databases are usually relational.
Table: books
title | author | release_year | rating | pages |
---|---|---|---|---|
1984 | George Orwell | 1949 | 5 | 328 |
The Hitchhiker's Guide to the Galaxy | Douglas Adams | 1981 | 4.5 | 243 |
You query it with:
SELECT title, author FROM books WHERE title = 'The Hitchhiker's Guide to the Galaxy';
Data is stored in a document store. Every entry is represented as a document.
noSQL databases are usually non-relational.
Collection: books
{
"title": "1984",
"author": "George Orwell",
"release_year": 1949,
"rating": 5,
"pages": 328
}
{
"title": "The Hitchhiker's Guide to the Galaxy",
"author": "Douglas Adams",
"release_year": 1981,
"rating": 4.5,
"pages": 243
}
To query the database, you can do the following.
// Query
{ title: 'The Hitchhiker\'s Guide to the Galaxy' }
// Options
{ select: 'title author' }