SQL WHERE
The WHERE
command allows you to filter the results of a query.
-- Works in PostgreSQL, MySQL, SQL Server, and Oracle
SELECT
*
FROM
rent_payments
WHERE
dollar_amount > 1900;
rent_payments
table
building_id | payment_date | dollar_amount |
---|---|---|
1 | 3/1/2018 | 2000 |
1 | 3/2/2018 | 1500 |
2 | 3/1/2018 | 1800 |
2 | 3/3/2018 | 1900 |
1 | 4/2/2018 | 2000 |
1 | 4/2/2018 | 1500 |
2 | 4/1/2018 | 1800 |
2 | 4/2/2018 | 1900 |
Results of query
building_id | payment_date | dollar_amount |
---|---|---|
1 | 3/1/2018 | 2000 |
2 | 3/3/2018 | 1900 |
1 | 4/2/2018 | 2000 |
2 | 4/2/2018 | 1900 |