MySQL is one of the popular relational database systems. With PHP, we can connect and manipulate MySQL databases.
Index
In this article, we will learn about the PHP MySQL database. PHP supports mostly all databases, like Oracle, MySQL, MariaDB, MongoDB, etc. Most commonly used is the freely available MySQL database.
MySQL is a relational database management system that uses structured query language (SQL). There is a more advanced MySQL enterprise edition available for tech giant companies. PHP and MySQL combine many options to create any website; from small to large corporate portals.
We can download MySQL for free from its official website.
MySQL database stores data into tables. A table is a set of data elements consisting of vertical columns and horizontal rows. Each row represents a data record in a table that is connected.
Example
The structure of a MySQL table that contains a person’s general information may look like the one shown below.
Id | Firstname | Lastname | |
---|---|---|---|
1 | Suman | Malukani | s@example.com |
2 | Riya | Shah | riya@example.com |
3 | Helly | Ahuja | helly@example.com |
4 | Rita | Kapoor | rita@example.com |
5 | John | Potter | john@example.com |
6 | Rahul | Sharma | rahul@example.com |
It consists of various fields such as Id, Firstname, Lastname, Email, etc.
SQL stands for the structured query language. It is a simple language for communicating with databases like MySQL.
With SQL, we can perform any database-related tasks such as creating database & tables, deleting & updating data records, sending a query to a database for specific records, etc.
Read Also: Top 25 MySQL Interview Questions and Answers for Experienced (Free PDF Download)
Queries are simply questions against a set of data. A database query is a request for data from a database. The request is to retrieve data. We can manipulate data using queries. The data come from different tables or even other queries.
Example
Select `email` from `person` where `Firstname` = "Suman"
If we execute the SQL query above, it will return the following record.
Output
s@example.com
Must Read: MySQLi Connect in PHP
MySQL is a relational database with SQL support for operations. Also, PHP provides strong support for the MySQL database. In the next article, we will learn about MySQL connections in PHP.
We hope you found this article helpful. Do refer to the PHP tutorial section to learn about the basics of PHP programming. Happy Learning!
There is a reason big-name companies like CNN use WordPress. WordPress is a popular content…
In this tutorial, I'm going to show you how to install MySQL on your computer.…
Download Turbo C++ for windows 10 in just 7 Mb and run your first C++…
We can redirect any webpage to any other or redirect the whole domain or website…
There are lots of methods to redirect pages, like refresh-redirect from META tag, redirect from…
Include files in PHP are used in appending various global or config files. We can…