DEV Community

Cover image for Relational Database & Back-end Concept

Posted on

Relational Database & Back-end Concept


Relational Database

RDBMS which stands for "Relational Database Management System." An RDBMS is a DBMS designed specifically for relational databases. Therefore, RDBMS are a subset of DBMS.
A relational database is a type of database that stores and provides access to data points that are related to one another. Relational databases are based on the relational model, an intuitive, straightforward way of representing data in tables. Relational databases use SQL or MySQL as the tool to access the data and is based upon ACID properties. Relational database, all data is held in tables, which are made up of rows and columns. Each table has one or more columns, and each column is assigned a specific datatype, such as an integer number, a sequence of characters that is used for text, or a date. Each row in the table has a value for each column.
A relational database is a collection of data items with pre-defined relationships between them. These items are organized as a set of tables with columns and rows. Tables are used to hold information about the objects to be represented in the database. Each column in a table holds a certain kind of data and a field stores the actual value of an attribute. The rows in the table represent a collection of related values of one object or entity. Each row in a table could be marked with a unique identifier called a primary key, and rows among multiple tables can be made related using foreign keys. This data can be accessed in many different ways without reorganizing the database tables themselves.
The tables of a relational database have some important characteristics:
 There is no significance to the order of the columns or rows.
 Each row contains one and only one value for each column.
 Each value for a given column has the same type.


Example of Relational Database

Here’s a simple example of two tables a small business might use to process orders for its products. The first table is a customer info table, so each record includes a customer’s name, address, shipping and billing information, phone number, and other contact information. Each bit of information that means each attribute, is in its own column, and the database assigns a unique ID that here a key to each row. In the second table—a customer order table—each record includes the ID of the customer that placed the order, the product ordered, the quantity, the selected size and color, and so on—but not the customer’s name or contact information.

These two tables have only one thing in common: the ID column (the key). But because of that common column, the relational database can create a relationship between the two tables. Then, when the company’s order processing application submits an order to the database, the database can go to the customer order table, pull the correct information about the product order, and use the customer ID from that table to look up the customer’s billing and shipping information in the customer info table. The warehouse can then pull the correct product, the customer can receive timely delivery of the order, and the company can get paid.


How does a relational database work?

The data tables used in a relational database store information about related objects. Each row holds a record with a unique identifier -- known as a key -- and each column contains the attributes of the data. Each record assigns a value to each feature, making relationships between data points easy to identify.

The standard user and application program interface (API) of a relational database is the Structured Query Language. SQL code statements are used both for interactive queries for information from a relational database and for gathering data for reports. Defined data integrity rules must be followed to ensure the relational database is accurate and accessible.

What are the types of databases?

There are several database categories, from basic flat files that aren't relational to NoSQL and newer graph databases that are considered even more relational than standard relational databases. Some database types include the following:

Flat file database: These databases consist of a single table of data that has no interrelation -- typically text files. This type of file enables users to specify data attributes, such as columns and data types.
NoSQL database: This type of database is an alternative that's especially useful for large, distributed data sets. NoSQL databases support a variety of data models, including key-value, document, columnar and graph formats.

Graph database: Expanding beyond traditional column- and row-based relational data models; this NoSQL database uses nodes and edges that represent connections between data relationships and can discover new relationships between the data. Graph databases are more sophisticated than relational databases. They are used for fraud detection or web recommendation engines.

Object relational database (ORD): An ORD is composed of both a relational database management system (RDBMS) and an object-oriented database management system (OODBMS). It contains characteristics of both the RDBMS and OODBMS models. A traditional database is used to store the data. It is then accessed and manipulated using queries written in a query language, such as SQL. Therefore, the basic approach of an ORD is based on a relational database.

However, an ORD can also be considered object storage, particularly for software written in the object-oriented programming language, thus pulling on object-oriented characteristics. In this situation, APIs are used in the storage and retrieval of data.


What are the advantages of relational databases?


The key advantages of relational databases include the following:
Categorizing data. Database administrators can easily categorize and store data in a relational database that can then be queried and filtered to extract information for reports. Relational databases are also easy to extend and aren't reliant on physical organization. After the original database creation, a new data category can be added without having to modify the existing applications.
Accuracy. Data is stored just once, eliminating data deduplication in storage procedures.
Ease of use. Complex queries are easy for users to carry out with SQL, the main query language used with relational databases.
Collaboration. Multiple users can access the same database.
Security. Direct access to data in tables within an RDBMS can be limited to specific users.

What are the disadvantages of relational databases?

The disadvantages of relational databases include the following:
Structure: Relational databases require a lot of structure and a certain level of planning because columns must be defined and data needs to fit correctly into somewhat rigid categories. The structure is good in some situations, but it creates issues related to the other drawbacks, such as maintenance and lack of flexibility and scalability.
Maintenance issues: Developers and other personnel responsible for the database must spend time managing and optimizing the database as data gets added to it.
Inflexibility: Relational databases are not ideal for handling large quantities of unstructured data. Data that is largely qualitative, not easily defined or dynamic is not optimal for relational databases, because as the data changes or evolves, the schema must evolve with it, which takes time.
Lack of scalability: Relational databases do not horizontally scale well across physical storage structures with multiple servers. It is difficult to handle relational databases across multiple servers because as a data set gets larger and more distributed, the structure is disrupted, and the use of multiple servers has effects on performance -- such as application response times -- and availability.

Examples of relational databases

Standard relational databases enable users to manage predefined data relationships across multiple databases. Popular examples of standard relational databases include Microsoft SQL Server, Oracle Database, MySQL and IBM DB2.

Cloud-based relational databases, or database as a service, are also widely used because they enable companies to outsource database maintenance, patching and infrastructure support requirements. Cloud relational databases include Amazon Relational Database Service, Google Cloud SQL, IBM DB2 on Cloud, SQL Azure and Oracle Cloud.


What are the differences between relational databases, non-relational databases and NoSQL?

The most important difference between relational database systems and non-relational database systems is that relational databases are normalized. That is, they store data in a tabular form, arranged in a table with rows and columns. A non-relational database stores data as files.
Other differences include the following:
Use of primary keys. Relational database tables each have a primary key identifier. In a non-relational database, data is normally stored in hierarchical or navigational form, without the use of primary keys.
Data values relationships. Since data in a relational database is stored in tables, the relationship between these data values is stored as well. Since a non-relational database stores data as files, there is no relationship between the data values.
Integrity constraints. In a relational database, the integrity constraints are any constraint that ensures database integrity. They are defined for the purpose of atomicity, consistency, isolation and durability, or ACID. Non-relational databases do not use integrity constraints.
Structured vs. unstructured data. Relational databases work well for structured data that conforms to a predefined data model and doesn't change much. Non-relational databases are better for unstructured data, which doesn't conform to a predefined data model and can't be stored in an RDBMS. Examples of unstructured data include text, emails, photos, videos and web pages.


What is Nodejs? Difference between Nodejs and JavaScript

Or is Node.js blocking or non-blocking?
**Node.js **is a virtual machine that is an open-source, cross-platform, non-blocking, server-side scripting, extremely powerful framework, which is used to build scalable programs and it’s developed on Chrome’s V8 JavaScript engine,

It’s a lightweight framework used for creating server-side web applications and extends JavaScript API to offer usual server-side functionalities. It provides an event-driven, non-blocking (asynchronous) I/O and cross-platform runtime environment for building highly scalable server-side applications using JavaScript.

There are so many differences between Node.js and JavaScript, of them only three are given below-
JavaScript Node.js
JavaScript is a programming language that is used for writing scripts on a website. NodeJS is a JavaScript runtime environment.
JavaScript is capable enough to add Html & play with the DOM. Nodejs cannot add Html tags.
JavaScript can run in any browser engine as like JS core in safari and Spider Monkey in Firefox. V8 is the JavaScript engine inside of node.js that parses and runs JavaScript.


Use of Node and Mongo in React project

The Node.js platform is a server-side runtime environment based on JavaScript which makes scalable programs. Node.js is fast, lightweight, and efficient runtime. Many more reasons to use Node in react project-

• They’re both JavaScript so we execute them server-side and client-side
• I get to inject V8 engine performance into my React app
• Node.js bundles the app into a single, easy-to-compile file
• It’s a real-time, data-intensive React app that we’re building.
• We get to run React.js code straight in the Nodejs environment
• We get to build JSON APIs for our app much easier when using Node and React together
• Rendering server-side becomes a more streamlined process
• ReactJS depends on Node and npm (Node Package Manager) to notify the native side (iOS/Android) of the packages that need to use in our app. Then, it can add all the needed dependencies
• The most important reason for the rising popularity of Node.js is that the programmer can code the server-side as well as the client-side using it. It’s is an interpreted, familiar and flexible language.

Mongo-DB is a document-oriented NoSQL database that provides high performance, high availability and easy scalability, build on a horizontal scale-out architecture. MongoDB databases are faster than SQL databases due to efficient indexing and storage techniques. We use this in react project because it provides-
• Flexible document schemas
• Code-native data access
• Change-friendly design
• Support primary and secondary index on any fields
• Uses JavaScript objects in place of procedures
• It uses a dynamic database schema
• It works on the concept of Collection and Document
• Powerful querying and analytics
• Easy horizontal scale-out
• Supports Ad Hoc Queries
• Supports Multiple Storage Engines

                     Thank You
Enter fullscreen mode Exit fullscreen mode

Top comments (0)