Solved

MySQL: Not empty

Posted on 2011-03-10
2
375 Views
Last Modified: 2012-05-11
How can I specify where a table is not empty?  

A table is empty if it is null or if it contains nothing or if it only contains whitespace.
SELECT * FROM `abc` WHERE `xyz` NOT EMPTY

Open in new window

0
Comment
Question by:hankknight
2 Comments
 
LVL 24

Accepted Solution

by:
jimyX earned 500 total points
ID: 35098567
SELECT * FROM `abc` WHERE (select count(*) from `xyz`) > 0
0
 
LVL 16

Author Comment

by:hankknight
ID: 35210308
I found that this also works:
SELECT * FROM `abc` WHERE length(xyz)>0

Open in new window

0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Loading csv or delimited data files to MySQL database is a very common task frequently questioned about and almost every time LOAD DATA INFILE comes to the rescue. Here we will try to understand some of the very common scenarios for loading data …
More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now