SQL - RDBMS Concepts

 Admin   
184 View    Jan 30 2020 10:32PM

What is RDBMS?

 

RDBMS stands for the Management System of Relational Databases. SQL and all existing database systems such as MS SQL Server, IBM DB2, Oracle, MySQL and Microsoft Access are based on RDBMS

A Relational database management system (RDBMS) is a database management system (DBMS) that is based on the relational model as introduced by E. F. Code.

 

What is a table?

The data in an RDBMS is stored in structures that are known as tables in the database. Essentially, this table is a list of related data entries and consists of multiple columns and rows.

Remember, a table is the most common and simplest form of data storage in a relational database. The following program is an example of a CUSTOMERS table

ID | NAME     | AGE | ADDRESS   | SALARY   |

+----+----------+-----+-----------+----------+

|  1 | Ramesh   |  32 | Ahmedabad |  2000.00 |

|  2 | Khilan   |  25 | Delhi     |  1500.00 |

|  3 | kaushik  |  23 | Kota      |  2000.00 |

|  4 | Chaitali |  25 | pune      |  6500.00 |

|  5 | Hardik   |  27 | Bhopal    |  8500.00 |

|  6 | Komal    |  22 | MP        |  4500.00 |

|  7 | Muffy    |  24 | Indore    | 10000.00

 

What is a field?

 

Each table is broken up into smaller entities called fields. The fields in the CUSTOMERS table are ID, NAME, AGE, ADDRESS and SALARY.

A field is a column in a table that is designed to maintain specific information about every record in the table.

 

What is a Record or a Row?

A record is also called as a row of data is each individual entry that exists in a table. For example, there are 7 records in the above CUSTOMERS table. Following is a single row of data or record in the CUSTOMERS table −

+----+----------+-----+-----------+----------+
|  1 | Ramesh   |  32 | Ahmedabad |  2000.00 |
+----+----------+-----+-----------+----------+

A record is a horizontal entity in a table.

 

What is a column?

A column is a vertical entity in a table that contains all information associated with a specific field in a table.

For example, a column in the CUSTOMERS table is ADDRESS, which represents location description and would be as shown below −

+-----------+
| ADDRESS   |
+-----------+
| Ahmedabad |
| Delhi     |
| Kota      |
| Mumbai    |
| Bhopal    |
| MP        |
| Indore    |
+----+------+

 

SQL Constraints

Constraints are rules that apply to data columns in a table. These are used to limit the type of data that can be entered in a table. This ensures that the data in the database is accurate and reliable.

Constraints can either be column level or table level. Column level constraints are applied only to one column whereas, table level constraints are applied to the entire table.

 

Following are some of the most commonly used constraints available in SQL −

·         NOT NULL Constraint − Ensures that a column cannot have a NULL value.

 

·         DEFAULT Constraint − Provides a default value for a column when none is specified.

 

·         UNIQUE Constraint − Ensures that all the values in a column are different.

 

·         PRIMARY Key − uniquely identifies each row/record in a database table.

 

·         FOREIGN Key − uniquely identifies a row/record in any another database table.

 

·         CHECK Constraint − The CHECK constraint ensures that all values in a column satisfy certain conditions.

 

·         INDEX − Used to create and retrieve data from the database very quickly.

Data Integrity

The following categories of data integrity exist with each RDBMS −

·        Entity Integrity − There are no duplicate rows in a table.

·        Domain Integrity − Enforces valid entries for a given column by restricting the type, the format, or the range of values.

·        Referential integrity − Rows cannot be deleted, which are used by other records.

·        User-Defined Integrity − Enforces some specific business rules that do not fall into entity, domain or referential integrity.

Database Normalization

Database normalization is the process of efficiently organizing data in a database. There are two reasons of this normalization process −

·        Eliminating redundant data, for example, storing the same data in more than one table.

·        Ensuring data dependencies make sense.

Both of these reasons are worthy objectives, since they reduce the amount of space the database consumes and ensure that the data is stored logically. Standardization consists of a series of guidelines that help guide you in creating a good database structure.

Guidelines for normalization are divided into normal forms; think of a form as the format or the way a database structure is laid out. The aim of the normal forms is to organize the structure of the database in such a way that it complies with the rules of the first normal form, the second normal form and finally the third normal form.

 

 

It is your choice to take it further and go to the fourth normal form, fifth normal form and so on, but in general, the third normal form is more than enough.