Showcasing the Flexible Schema Concept in JSON Databases
Traditional Relational Database Approach (Rigid Schema): A database storing information about books but in traditional relational database the column requires constrains and specific data types.
Table: Books
- book_id (INT, Primary Key)
- title (VARCHAR(255))
- author (VARCHAR(255))
- publication_year (INT)
- genre (VARCHAR(50))
JSON Database Approach (Flexible Schema): A database storing information about books but in JSON database only the column and value is stored in key value format without any constraints. The data types are implicit so, we do not need to declare them.
JSON
[
{
"book_id": 1,
"title": "The Lord of the Rings",
"author": "J.R.R. Tolkien",
"publication_year": 1954,
"genre": "Fantasy"
},
{
"book_id": 2,
"title": "Pride and Prejudice",
"author": "Jane Austen",
"publication_year": 1813,
"genre": "Romance"
},
{
"book_id": 3,
"title": "A Brief History of Time",
"author": "Stephen Hawking",
"publication_year": 1988,
"genre": "Science",
"awards": [
"Booker Prize 1988"
]
}
]
Why NoSQL JSON Databases Are So Useful
NoSQL JSON databases are replacing traditional relational databases for scalability and flexibility. With schema-free design, they excel in handling unstructured and large datasets, making them ideal for agile development and diverse applications with evolving requirements.
It stores data in a human-readable format in JavaScript Object Notation(JSON). In this article, we will learn the reasons why the NoSQL JSON databases are useful.