Skip to content

Instantly share code, notes, and snippets.

@embayer
Last active August 29, 2015 14:10
Show Gist options
  • Save embayer/aca2114a98dffd0ba70e to your computer and use it in GitHub Desktop.
Save embayer/aca2114a98dffd0ba70e to your computer and use it in GitHub Desktop.
collection of useful sql statements
-- find duplicated values
SELECT
address_line1, address_line2, zip, city, country, COUNT(*)
FROM
location
GROUP BY
address_line1, address_line2, zip, city, country
HAVING
COUNT(*) > 1;
-- show the average length of a column
SELECT
AVG(LENGTH(column1))
FROM table1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment