Database in PHP

We know PHP is a server-side scripting language and PHP can connect and interact with many database management systems such as MySQL, Oracle, PostgreSQL. We can make CRUD (Create, Retrieve, Update, Delete) operations very easily using PHP. Databases are useful for storing information. As we discussed earlier there are many DBMS available in the market, But here in this tutorial series, we will learn about MySQL Database.

What is MySQL?

MySQL is one of the most popular DBMS used in PHP. MySQL is an open-source relational database management system. MySQL is developed by Michael Widenius on 23 May 1995. The name MySQL is a combination of MY which is the name of the developer's daughter and SQL which stands for Structured Query Language. MySQL stores data in tables made up of rows and column, We can perform CRUD operation in PHP using SQL(Structured Query Language). A query can be a question or request to add, fetch or modify data in the database.

MySQL Query Example:

Please check the following example of a query to create a table in MySQL.

CREATE TABLE Students(
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(30) NOT NULL,
email VARCHAR(50),
mobile VARCHAR(12),
reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)

In the above example, CREATE TABLE query is used to create the Students table with id, name, email, mobile, reg_date(columns). 

Spread the love
Scroll to Top