Relational database (MySql)
Tags: database, mysql, webdev, programming
Published: 2021-12-23 16:25:30

What is a Relational Database?
A relational database is a type of database. It uses a structure that allows us to identify and access data in relation to another piece of data in the database. Often, data in a relational database is organized into tables

What is a Relational Database Management System (RDBMS)?
A relational database management system (RDBMS) is a program that allows you to create, update, and administer a relational database. Most relational database management systems use the SQL language to access the database.

What is SQL?
SQL (Structured Query Language) is a programming language used to communicate with data stored in a relational database management system. SQL syntax is similar to the English language, which makes it relatively easy to write, read, and interpret.

Many RDBMSs use SQL (and variations of SQL) to access the data in tables. For example, SQLite is a relational database management system. SQLite contains a minimal set of SQL commands (which are the same across all RDBMSs). Other RDBMSs may use other variants.

(SQL is often pronounced in one of two ways. You can pronounce it by speaking each letter individually like “S-Q-L”, or pronounce it using the word “sequel”.)

Popular Relational Database Management Systems
SQL syntax may differ slightly depending on which RDBMS you are using. Here is a brief description of popular RDBMSs:

MySQL

MySQL is the most popular open source SQL database. It is typically used for web application development, and often accessed using PHP.

The main advantages of MySQL are that it is easy to use, inexpensive, reliable (has been around since 1995), and has a large community of developers who can help answer questions.

Some of the disadvantages are that it has been known to suffer from poor performance when scaling, open source development has lagged since Oracle has taken control of MySQL, and it does not include some advanced features that developers may be used to.


How Is Data in a Relational Database System Organized?
Relational database systems use a model that organizes data into tables of rows (also called records or tuples) and columns (also called attributes or fields). Generally, columns represent categories of data, while rows represent individual instances.
Let's use a digital storefront as an example. Our database might have a table containing customer information, with columns representing customer names or addresses, while each row contains data for one individual customer.

These tables can be linked or related using keys. Each row in a table is identified using a unique key, called a primary key. This primary key can be added to another table, becoming a foreign key. The primary/foreign key relationship forms the basis of the way relational databases work.
Returning to our example, if we have a table representing product orders, one of the columns might contain customer information. Here, we can import a primary key that links to a row with the information for a specific customer.

This way, we can reference the data or duplicate data from the customer information table. It also means that these two tables are now related.