PHP MySQL Introduction

MySQL is the most popular database system used with the PHP language.

What is MySQL

MySQL is one of the most popular relational database system being used on the Web today. It is freely available and easy to install, however if you have installed Wampserver it already there on your machine. MySQL database server offers several advantages:

  • MySQL is easy to use, yet extremely powerful, secure, and scalable.
  • MySQL runs on a wide range of operating systems, including UNIX, Microsoft Windows, Apple Mac OS X, and others.
  • MySQL supports standard SQL (Structured Query Language).
  • MySQL is ideal database solution for both small and large applications.
  • MySQL is developed, and distributed by Oracle Corporation.
  • MySQL is very fast and secure. It includes data security layers that protect sensitive data from intruders.

MySQL database stores data into tables like other relational database. A table is a collection of related data, and it is divided into rows and columns.

Each row in a table represents a data record that are inherently connected to each other such as information related to a particular person, whereas each column represents a specific field such as 'first_name', 'last_name', 'email_address', etc. The structure of a simple MySQL table that contains person's general information may look something like this:

| person_id | first_name | last_name | email_address        |
|         1 | Peter      | Parker    | |
|         2 | John       | Rambo     |   |
|         3 | Clark      | Kent      |   |
|         4 | John       | Carter    |  |
|         5 | Harry      | Potter    | |

Talking to MySQL Databases with SQL

SQL, the Structured Query Language, is a simple, standardized language for communicating with relational databases like MySQL. With SQL you can perform any database-related task, such as creating databases and tables, saving data in database tables, query a database for specific records, deleting and updating data in databases.

Look at the following standard SQL query that returns the email address of a person whose first name is equal to 'Peter' in the persons table:

SELECT email_address FROM persons WHERE first_name="Peter"

If you execute the SQL query above it will return the following record:

Your Feedback:


We would love to hear from you! Please say something.