Introduction to relational databases
Relational databases started to get to be a big deal in the 1970’s, and they are still a big deal today. Without databases many things would become impossible tasks. We also use databases on the internet.
We are going to learn more about MySQL database which is one of the fastest and what’s more, it’s free. SQL stands for Structured Query Language. If you already have some experience with PHP programming and would like to use your PHP scripts with MySQL database, you can download MySQL from here. Find an FTP mirror. Under “packages” or “downloads” find “Win32” folder and the needed file mysql-3.23.36-win.zip (or more recent). Install and configure MySQL database on your computer, and develop your PHP scripts locally. Of course, if you want to publish your PHP/MySQL files online, find out if your host can establish and configure a MySQL account for you. This tutorial also could be useful for those who already know Perl programming and would like to use Perl scripts with MySQL database.
A relational database is a bunch of rectangular tables. Each row of a table is a record about one person or thing. The record contains several pieces of information called fields. Each field comes in several forms and sizes – called datatypes. Well, we can consider the hierarchy of a database as following:
Database -> Table -> Record -> Datatype
And here is an example table:
FIRSTNAME | LASTNAME | AGE | SEX | ID |
John | Smith | 24 | M | 19754 |
Angela | Power | 29 | F | 765 |
The names of the fields are FIRSTNAME, LASTNAME, AGE, SEX, ID. Each row in the table is a record. For example, the first row of the table represents a 24-year-old male John Smith, whose ID number is 19754. As you can see, tables are simple and easy to understand.
Well, let’s move on to the next section MySQL datatypes.