RDBMS – RDBMS full form is Relational Database Management Systems. It forms the basis for SQL, DB2, Oracle etc. It is based on the relational model defined by E.F.Codd
Table in SQL
In RDBMS, the organization of data is in the form of tables. A table is a collection of related data entities and is an arrangement of rows and columns. It is the common and easy form to store data in RDBMS. The below table is an example of a table of Student Data
Name | Age | Marks | Grade |
Pavan | 20 | 982 | S |
Akhil | 22 | 970 | A |
Rohit | 21 | 890 | B |
Field in RDBMS
A table is broken into small parts and they are known as an entity. The above table has fields like Age, Marks, Grade, Name. A field is nothing but a column in the table that store particular information about each record in a table.
Row or Record
A row corresponds to each entry in the table. The above table has 5 rows. The example of a row for the above student table is given below:
Pavan | 20 | 982 | S |
Column
A column is a vertical entity in a table that has all information related to a specific field in the table, The column Age of the above student table is given below:
Marks |
982 |
970 |
890 |
NULL Value
A NULL value in a table means the field has an empty value.NULL value is different from zero or field with spaces. A NULL value occurs in the table when no value is given while creating a record
Constraints in SQL
Constraints enforce rules on the table. They limit the type of data that goes into the table. Also, these constraints ensure accuracy and reliability of the data
Some constraints are applicable to column level whereas some are applicable to table level. The following are the some of the constraints available in SQL:
- NOT NULL – Useful in ensuring that a column cannot have a NULL value
- DEFAULT – Useful in providing the default value for the column when none is specified
- UNIQUE – Useful in ensuring that all values of a column are unique
- PRIMARY KEY – Useful in identifying a row uniquely in a table
- FOREIGN KEY – Useful in identifying a row uniquely in another table
- CHECK – Useful in ensuring that all values in column should follow certain conditions
Data Integrity
The following types of Integrity are present in RDBMS
- Entity Integrity means No duplicate record in the table
- Domain Integrity which restricts type, format,and also range of values for a column
- Referential Integrity means rows cannot be deleted if they are used by other records
- User-Defined Integrity which is useful in enforcing business rules
Database Normalization
Database Normalization is the process of organizing data in the database and is useful in removing redundant data and also to make data dependencies clear
Normalization reduces the space consumed by a database. Also, it has a set of guidelines which helps in creating a good database
Normally there are five types of normal forms and third normal form is more than enough in real-time databases.