While writing a WHERE query, when you simply give column name after WHERE keyword. It means true in boolean.
Understand it with example.
Make a database by running query–
CREATE DATABASE jai_school;
Create a table in the database–
CREATE TABLE mobiles(brand_name VARCHAR(30),price INT(10));
Insert data in the table–
INSERT INTO mobiles(brand_name,price)VALUES("Samsung",80000);
INSERT INTO mobiles(brand_name,price)VALUES("Apple",140000);
INSERT INTO mobiles(brand_name,price)VALUES("Nokia",25000);
INSERT INTO mobiles(brand_name,price)VALUES("MI",14000);
INSERT INTO mobiles(brand_name,price)VALUES("Honor",9000);
INSERT INTO mobiles(brand_name,price)VALUES("Sony",18000);
INSERT INTO mobiles(brand_name,price)VALUES("Realme",14000);
INSERT INTO mobiles(brand_name,price)VALUES("Oneplus",28000);
INSERT INTO mobiles(brand_name,price)VALUES("Motorola",13000);
Table Image:

SELECT * FROM mobiles WHERE price;
When you run above query, you see only NULL values are filtered if any.
Publish A Comment