DBMS And Databases

what is database?

Database is an organized collection of data store in a computer system and usually controlled by the database management system. It defines a relationship between the how the data is structured and related to each other.

what is DBMS?

Database Management System is a software designed to create, manage, manipulate, and interacts with databases.it performs the database administrative operations. It handles backup and restore operations to protect data against loss or corruption and data security.

Types of databases

1. SQL

2. NoSQL

SQL or (Relational Database):

This database establishes a relationship between the data, this data will store in table with columns and rows.

each table has a unique Identity is called primary Key; each table can make a relationship with multiple other tables by using foreign key. This database will follows ACID properties.

SQL supports materialized views

Materialized views means it reduces the computation time of query retrieval access. basically it stores the result of the query for better performance.

Advantages of SQL

  • Simple and accurate

  • Accessibility

  • Data consistency

  • Flexibility

Disadvantages

  • Difficult schema evolution

  • Expensive to maintain.

  • Performance hits (join, denormalization, etc.)

  • Difficult to scale due to poor horizontal scalability.

NoSQLDatabase

NoSQL databases related to non-relational databases, which database doesn't have to conform to a pre-defined schema. it follows Base Model.

Base means Basically Available, Soft State and Eventually Consistency.

Basically Available: It prioritizes Availability over consistency if any network fails, we can still interact with database.

Soft state: It states that data will not consistency all times.

Eventually Consistency: It Guarantees the consistency of data, but it will take some time for to get the consistent data for all distributed nodes.

For different types of databases

Document:

A document database (also known as a document-oriented database or a document store) is a database that stores information in documents. They are general-purpose databases that serve a variety of use cases for both transactional and analytical applications.

Examples: MongoDB, CloudDB.

Key-value:

It stores the information in key-value pairs, we can access the data by using the key.

Examples: Redis, Amazon DynamoDB

Graph:

Graph is a NoSQL database it represents the data in the form of graph structure having the edges and nodes, where edges present the relationship between the nodes.

Examples: ArganoDB.

Timeseries:

Time-series data refers to data points that are associated with a timestamp or time interval, such as sensor readings, stock prices, IoT device data, server metrics, weather data, and more.

Example: InfluxDB, TimescaleDB.

SQL VS NoSQL Databases:

Both the databases are used to store the data but they serve as different in data storing. In relational databases store the data in the form of predefined schemas. Each table has columns that define the data attributes or fields, and rows represent individual records or data instances. and in a structural way and non-relational databases are store data in unstructured way

Storage:

SQL databases store the data in the table using rows and columns.

NoSQL databases uses the key-value pair to store the data.

Schema:

SQL databases as a predefined schema, for to enter data we have a predefined structure, and we can update or alter the schema later.

NoSQL databases have no structure is defined, and we have a flexible schema.

Scalability:

SQL databases is very complex and expensive for the scaling

NoSQL databases are easy for scaling.

Reliability:

The vast majority of relational databases are ACID compliant. So, when it comes to data reliability and a safe guarantee of performing transactions, SQL databases are still the better bet.

Most of the NoSQL solutions sacrifice ACID compliance for performance and scalability.

Normalization and Denormalization:

Normalization:

refers to databases, It is used for processing the data in an organizing way and structured way in the relational databases, it improves the dataintergity and reduces the data anomies.

Types of normalization:

1. First Normal Form (1NF): It ensures that atomicity in the table and it will not support the mixed datatype in a column.

2.Second Normal Form(2NF): It satisfies the 1NF and it doesn't support partial dependency.

3.Thired Normal Form (3NF):It satisfies the 2NF and no transitive dependencies.