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
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
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 |
columns
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
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
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 key
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.