Top SQL Questions

Kevin Ashley

SQL Query to Find Users with a Valid Email Address

This problem asks for a SQL query to find all users in a table who have a valid email address.

Problem

Given a table of user data, write a SQL query to find all users who have a valid email address.
Input:
User table with columns: id, name, email
Output:
List of all users with a valid email address

Solution

This solution is in SQL. Our A.I. can create solutions in multiple languages.
by AskAI
SELECT * FROM USERS WHERE EMAIL LIKE '%@%'

A.I. Evaluation of the Solution

This solution is incomplete because it does not account for email addresses that may have more than one '@' character. A more complete solution would use a regular expression to match email addresses.

Evaluated at: 2022-11-03 20:14:35

Community solutions:

Check these solutions from our community and artificial intelligence:
The solution correctly uses the LIKE operator to check if the email contains an @ symbol.