Solved

MySQL: Not empty

Posted on 2011-03-10
2
388 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

808 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