有没有办法通过一个条件获取记录

Is there a way to get records by only one condition instead of these three conditions :-

select * from product
where price != '' and price != 0 and price is not null

price column's DDL is price varchar(15) default null

If you're concerned about the length of the condition, you could try this:

select * from product
where price > ''

or even probably better

select * from product
where price

If you make price a numeric type and with NOT NULL for default, you can get away with checking just for != 0.

Well, empty string evaluates as false, 0 evaluates as false and NULL evaluates as false, so this should work:

SELECT * FROM product WHERE price;