Solved

Query Database For Table - Email that has a blank, missing, or no data

Posted on 2016-10-20
7
70 Views
Last Modified: 2016-11-02
I have a membership database.  One of the fields is "Email".  That field CAN be blank.  I'd like to query the database and find all member records with no data in the Email field.  That we can reach out to those members and ask them to update their e-mail address.

SQL database.  Thank you.
0
Comment
Question by:derrickisonline
7 Comments
 
LVL 42

Accepted Solution

by:
zephyr_hex (Megan) earned 500 total points
ID: 41852302
It's not entirely clear what you're looking for... but to find blank or NULL Email records, you would do:

SELECT * from MyTable WHERE Email IS NULL OR Email = ''

Open in new window

0
 

Author Closing Comment

by:derrickisonline
ID: 41852325
You stated you didn't know what I was looking for, but that was exactly it.  I just needed to know which records had a missing email address field.  That way we can reach out and have members update their email addresses.  

Thank you!
0
 
LVL 32

Expert Comment

by:awking00
ID: 41852330
Slight variation -
SELECT * from MyTable WHERE ISNULL(Email,'') = ''
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 20

Expert Comment

by:Russ Suter
ID: 41852334
I might slightly enhance what is above to perform at least a rudimentary search for a valid email address.
SELECT * FROM myTable WHERE Email IS NULL OR Email NOT LIKE '%_@__%.__%'

Open in new window

This at least guarantees that the email address will have a minimum of a single "@" and a single "."
This query would return empty, blank, and invalid email addresses.
0
 

Author Comment

by:derrickisonline
ID: 41852360
One more thing, can you tell me how to use the query you provided but drilling down again buy saying Membership Status = Active?
0
 
LVL 42

Expert Comment

by:zephyr_hex (Megan)
ID: 41852676
SELECT * from MyTable WHERE (Email IS NULL OR Email = '') AND [Membership Status] = 'Active'

Open in new window

1
 

Author Comment

by:derrickisonline
ID: 41870407
Thanks again!
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

772 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