Learn MySQL Queries With Examples

In this article, you will learn select, update and delete statements in MySQL queries with examples.

MySQL is the most popular database system used in PHP. The databases are used to store and categorize data.

Select statement

Select statement is used to display one or more tables separated by a comma in the database. Select query is used to retrieve records into the database. You can display a record in the condition, using WHERE clause. I have already created a database. Hence, you can create a database and table.

Xampp download link.

After you have installed Xampp, open cmd (command prompt) and follow the commands written in it.


Figure - List of databases

Figure - use of “use” command

If you are not having any database created, you can create a database by writing the command in your cmd.

Figure - Create a database

Now, you have successfully created your database.

Figure - New database is being shown in the list of the databases

Now, let us see the command to create a table in the database. 

Figure - Create a table in the database.

Figure -Inserting data value into the table.

 Figure - Select statement is shown.

Figure - Select statement with WHERE clause in MYSQL.

Figure - Select statement with Group by

Select statement with join. 

Figure - Left join is shown

Figure -Inner join is depicted

Figure - Right join is shown

Figure - All the records are shown before any deletion. 

Figure - Running Delete query yields. 

Figure - After running Delete query, display of the remaining records is shown above.


After going through the above explanation with the examples, you should be very clear about the general queries commonly used in various projects.