MySQL is one of the popular relational database systems. With PHP, we can connect and manipulate MySQL databases.
Index
MySQL Database With PHP
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.
What is MySQL?
- MySQL is a popular relational database system.
- It is available free-of-cost & is easy to install.
- MySQL database server offers several advantages.
- It is easy to use, extremely powerful, secure & scalable.
- MySQL runs on various operating systems, including UNIX or LINX, Microsoft windows, apple MAC OSX and others.
- It supports SQL (standard query language).
- MySQL database is an ideal solution for small and large applications.
- It includes data security that protects sensitive data from the attacker.
How to Download MySQL Database
We can download MySQL for free from its official website.
MySQL Database Table
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 | [email protected] |
2 | Riya | Shah | [email protected] |
3 | Helly | Ahuja | [email protected] |
4 | Rita | Kapoor | [email protected] |
5 | John | Potter | [email protected] |
6 | Rahul | Sharma | [email protected] |
It consists of various fields such as Id, Firstname, Lastname, Email, etc.
Database With SQL
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)
Database Queries
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
[email protected]
Must Read: MySQLi Connect in PHP
Conclusion
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!