Table

customers

6 columns · 0 foreign keys · referenced by 0 tables

Columns

#NameTypeKey
01cust_idSERIALPK
02nameVARCHAR(150)
03emailVARCHAR(120)
04cityVARCHAR(100)
05countryVARCHAR(80)
06tierVARCHAR(20)

Example queries against this table

  1. Select customers from India or USA
    SQL
    SELECT name, city, country
    FROM customers
    WHERE country IN ('India', 'USA', 'United States')
    ORDER BY country, city;
  2. List all unique countries from customers
    SQL
    SELECT DISTINCT country
    FROM customers
    WHERE country IS NOT NULL
    ORDER BY country;
  3. Find customers whose email contains "gmail"
    SQL
    SELECT name, email, city
    FROM customers
    WHERE email ILIKE '%gmail%';
  4. Find customers NOT from India
    SQL
    SELECT name, country, city
    FROM customers
    WHERE country != 'India' -- or: WHERE country <> 'India'
    ORDER BY country;