What is Relational Database?
A Database is a collection of Data, and in Computer science, there are various types of Database and they are categories how each database store and organize data. A Relational Database use tables to store data in rows and columns, it is known as Relational Database because each data which reside in the table has a relation to its respective row and column.
What is RDBMS?
RDBMS stands for Relational Database Management System, and it is a set of applications which is used to create and manage Relational Database, SQL is a standard Language used for RDBMS applications. All the RDBMS applications such as MS SQL, MySQL, SQLite, PostgreSQL, Oracle, etc use SQL (Structured Query Language).
What is a Table in an RDBMS?
RDBMS use table-like structure to store data, and a single Database can have more than one Table. A Database can be divided into multiple objects and these objects are known as database tables. Each table can have numerous columns and rows and each row has a relation with the respective column. Example:
+----------+-----+-----+------+---------+ | Roll No | NAME| AGE | Grade | Marks | +----+----------+-----+-----------+-----+ | 1 | Ben | 16 | B | 877 | | 2 | Gohan | 15 | A | 900 | | 3 | Saitama | 16 | A | 904 | | 4 | Goku | 15 | B | 782 | | 5 | Luffy | 17 | A | 976 | | 6 | Zoro | 16 |B | 863 | | 7 | Naruto | 16 | C | 780 | +----+----------+-----+------+------+
What are the Fields in Tables?
A field is a name given to the column which provides a piece of the specific information related to that column present in that table. To make a table we require entities and these small entities in the table are known as Fields, in the above example Roll No, Name , AGE, Grade, and Marks are the entities or fields of the Table.
What are rows in Table?
A row can be also referred as a record which contains all the information of a specific individual, all the horizontal lines refer as rows. In the above table, there are 7 rows and each row give proper information about an individual. Using the RDBMS, we can access a complete row using the SELECT command:
+----+----------+-----+------+ | 1 | Ben | 16 | B| 877 | +----+----------+-----+------+
What are the Columns in Table?
All the vertical entities are known as column a complete single column can provide you with information about the specific field of various individuals.
+-----+ |Marks| +-----+ | 877 | | 900 | | 904 | | 784 | | 976 | | 863 | | 780 | +-----+
Null Value in a Table
If there is a blank value in a table or if there is no value present in the table then it would be considered as Null value. A null value is very important in SQL database and we often require them when there is some optional data which user does not to fill. We also keep in mind that zero or 0 is a value and it is different from Null, In SQL to represent NULL we use the NULL keyword.
SQL constraints are some set of rules which are used when we create a table in Database, and these constraints are used to set rules regarding the fields we have created. Constraints are often used to specify the character and role of the fields in the table, so when we insert data in the table and if the data does not match the constraints rule then your action will be aborted, and data will not be stored in the Database. Here are some common constraints used in SQL:
- NOT NULL: It specifies that the field cannot have a NULL value which means all the data must have a value.
- UNIQUE: It specifies that the field’s data values should be distinct and unique.
- PRIMARY Key: A Field is a primary key then it must be a combination of NOT NULL and UNIQUE constraint, which mean PRIMARY KEY field’s all values must be distinct and every data set must have a value.
- FOREIGN KEY: A field which is primary in nature and can be used as a bridge between two tables.
- CHECK: It set a condition and ensures that all values in a column satisfy a specific condition
- DEFAULT: If the user does not pass a value then the default value passed in that field.
- INDEX: It provides a value unique value to the row so data can be retrieved very quickly.
Integrity Constraints are the rules used to maintain the data integrity, which means an Integrity constraint ensures that the data insertion, updating, and other processes have to be performed in such a way so that data integrity is not affected. There are 4 types of integrity Constraints:
1. Entity Integrity
Entity Integrity deals with the primary key and ensures that there are no NULL and repeated values.
2. Domain Integrity
It makes sure that the data must follow that respective field data type character, format and range.
3. Referential Integrity
In the Referential integrity constraints, if a foreign key in Table 1 refers to the Primary Key of Table 2, then every value of the Foreign Key in Table 1 must be null or be available in Table 2.
4. Key Integrity
Key integrity use to set the key contains to the tables, and an entity can have multiple keys.
In Normalization, we use some techniques which divide the current table into multiple small tables to reduce the data redundancy and minimize the database size as much as possible. There are 4 types of Normalizations:
- 1 st Normal form
- 2 nd Normal Form
- 3 rd Normal Form
- Boyce-Codd Normal form
- 4 th Normal Form
RDBMS Quick Summary:
- RDBMS stands for Relational Database Management System.
- RDBMSs are the software which use SQL to create and modify Relational Databases.
- A Relational Database store data in tabular form.
- A Database can have more than one table.
- Constraints are the rules which specify the field character and role in the table.
- Normalization is a technique to divide a single table into smaller tables so the data redundancy can be minimized.
People are also reading: