Relational Database Management System (RDBMS) is a DBMS software that helps to interact with databases. They use Structured Query Language (SQL) to interact with the data stored in tables.
Database is a collection of logically related data. They are accessed by many users for different purposes. For example, a sales database contains entire information about sales which is stored in many tables.
Tables is the basic unit in RDBMS where the data is stored. A table is a collection of rows and columns. Following is an example of employee table.
EmployeeNo | FirstName | LastName | BirthDate |
---|---|---|---|
101 | Mike | James | 1/5/1980 |
104 | Alex | Stuart | 11/6/1984 |
102 | Robert | Williams | 3/5/1983 |
105 | Robert | James | 12/1/1984 |
103 | Peter | Paul | 4/1/1983 |
A column contains similar data. For example, the column BirthDate in Employee table contains birth_date information for all employees.
BirthDate |
---|
1/5/1980 |
11/6/1984 |
3/5/1983 |
12/1/1984 |
4/1/1983 |
Row is one instance of all the columns. For example, in employee table one row contains information about single employee.
EmployeeNo | FirstName | LastName | BirthDate |
---|---|---|---|
101 | Mike | James | 1/5/1980 |
Primary key is used to uniquely identify a row in a table. No duplicate values are allowed in a primary key column and they cannot accept NULL values. It is a mandatory field in a table.
Foreign keys are used to build a relationship between the tables. A foreign key in a child table is defined as the primary key in the parent table. A table can have more than one foreign key. It can accept duplicate values and also null values. Foreign keys are optional in a table.