How to Filter with the WHERE clause in SQL

Опубликовано: 28 Сентябрь 2024
на канале: Becoming a Data Scientist
34,806
847

Filter your SQL table for the information you need by using the WHERE clause!

Queries using WHERE:
1) Filter your query based on an exact match: SELECT * FROM table WHERE column='value'
2) Filter your query using Wildcards to match a pattern: SELECT * FROM table WHERE column LIKE '%str%ing%'
3) Filter your query using numeric operators: SELECT * FROM table WHERE column < 5
4) Beef up your filters by using the AND & OR statements: SELECT * FROM table WHERE (column1 < 5 AND column2 LIKE '%a%') OR column3 = 1
5) Exlude info from you query using the NOT clause: SELECT * FROM table WHERE NOT column1 = 1
6) Pull a range of information using the BETWEEN clause: SELECT * FROM table WHERE column1 BETWEEN 1 AND 5
7) Extract all the NULL or NOT NULL values out of your table: SELECT * FROM table WHERE column1 IS NULL

Get the Northwind Database:    • How to Load a Sample PostgreSQL Datab...  

Support the Channel:
1) Subscribe:
2) DataCamp:
3) Udacity: