DBMS For Application Development: Relational Model & Relational Database

Lenique Noralez - Apr 8 '19 - - Dev Community

Photo by Carlos Muza on Unsplash

Laptp

A data model is an abstract model used to organize your application data and describes how your data relate to one another and real world objects.
There are many types of data models but the most widely used one is the relational model due to its simplicity.

The relational model represents data in tables and are grouped into relationships. A database that uses the relational model is known as a relational database.

The tables in a relational database is assigned a unique name, usually a name that describe what’s going to be stored in the table.

Below is diagram showing the use of the relational model to describe the database structure and relationship of data in a photo sharing application. This diagram shows how data is related and separated into different tables. Properly modeling your data is powerful in relational databases because it reduces the chances of data being duplicated and redundant data being retrieved.

Data Model Diagram

The diagram above is know as a schema diagram. A schema diagram is a visual representation of the database schema that shows the relationship in the database, table attributes, primary key and foreign key.

The schema is the logical design of the database, it includes the table attribute, attribute type and primary and foreign key constraints.

The primary key is a set of one or more attribute whose values are used to uniquely identify rows in a table. For example the user_id, username and email in the users table are unique for each user record in the table, these three fields are used to uniquely identify a user.

A foreign key is a set of attributes that identifies a record in another table, the foreign key in the referencing table is always the primary key in the referenced table. A foreign key in the above data model would be the uid in the followers table that references a user in the user table.

Building an application that uses a relational database requires a lot of thinking ahead to ensure data is retrieved efficiently.

Useful Resources

. . . .