Table
customers
6 columns · 0 foreign keys · referenced by 0 tables
Columns
| # | Name | Type | Key |
|---|---|---|---|
| 01 | cust_id | SERIAL | PK |
| 02 | name | VARCHAR(150) | |
| 03 | VARCHAR(120) | ||
| 04 | city | VARCHAR(100) | |
| 05 | country | VARCHAR(80) | |
| 06 | tier | VARCHAR(20) |
Example queries against this table
- Select customers from India or USASQL
SELECT name, city, country FROM customers WHERE country IN ('India', 'USA', 'United States') ORDER BY country, city; - List all unique countries from customersSQL
SELECT DISTINCT country FROM customers WHERE country IS NOT NULL ORDER BY country; - Find customers whose email contains "gmail"SQL
SELECT name, email, city FROM customers WHERE email ILIKE '%gmail%'; - Find customers NOT from IndiaSQL
SELECT name, country, city FROM customers WHERE country != 'India' -- or: WHERE country <> 'India' ORDER BY country;