Common SQL Queries

These are some common SQL queries that come up. All ? symbols represent a place where you would dynamically insert info, like with Node's MySQL module.

Retrieval

Get the info from all rows with a given email

SELECT * FROM example_table
  WHERE email = ?;

See if more than one entry exists with a given email

SELECT email, COUNT(email) 
  FROM example_table
  GROUP BY email
  HAVING COUNT(email) > 1;

References

Last modified: 202105310620