MySQL Select Query with Where Clause

MySQL Select Query with Where Clause:

(1) In the previous blog we learn about MySQL Insert Query to insert data into the database table. Now in this blog, we learn about how to read data from a database table.

(2) If you want to select some columns in a database, then use the below syntax.

SELECT column1, column2, ……….
FROM table_name;

(3) Now open the MySQL Workbench and log in to it. Now go to the table and write the “select” query to get particular columns as shown.

mysql select statement to select particular column

(4) You can also change the column id in the display by using the following query as shown below.

MySQL select query to change column id

(5) If you want to select all columns in a database, then use the below syntax.

SELECT * FROM table_name;
MySQL select query for all data from column

(6) Now we use the WHERE clause with the SELECT statement or query. The WHERE clause is used to filter records. It is used to extract only those records that fulfill a specified condition. The syntax is given below.

SELECT column1, column2, ……….
FROM table_name
WHERE condition

(7) Some basic conditions which we use with the WHERE clause are given below.

=Equal
!=Not Equal
>Greater Than
<Lesser Than
>=Greater than or Equal to
<=Lesser than or Equal to
  • Use Equal Condition:
mysql where clause using equal condition
  • Use Greater Than Condition:
mysql select statement use greater than condition
  • Use Lesser Than Condition:
mysql select statement use lesser than condition
  • Use Greater than or Equal to Condition:
mysql where clause condition Greater than or Equal to
  • Use Not Equal Condition:
mysql where clause Not Equal Condition

Programming Languages
Computer Input Devices
Secondary Storage Devices
World Wide Web (WWW)
Application Software
Operating System as a Resource Manager
MySQL– Wikipedia

Comments (No)

Leave a Reply