The following syntax will fetch all the values from the column −
select * from yourTableName where yourColumnName=0;
Let us first create a table −
mysql> create table DemoTable1791 ( FirstName varchar(20) ); Query OK, 0 rows affected (0.00 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1791 values('David'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1791 values('John'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1791 values('Carol'); Query OK, 1 row affected (0.00 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1791;
This will produce the following output −
+-----------+ | FirstName | +-----------+ | David | | John | | Carol | +-----------+ 3 rows in set (0.00 sec)
Here is the query wherein we are implementing select where value is zero −
mysql> select * from DemoTable1791 where FirstName=0;
This will produce the following output
+-----------+ | FirstName | +-----------+ | David | | John | | Carol | +-----------+ 3 rows in set, 3 warnings (0.00 sec)