I hope that when you’re reading this you already have database access at work and have written your first query!
Let’s recap the tips & tricks we’ve seen in this chapter:
Commenting filters in queries
Prepending the 1 = 1
filter (which is always equals to TRUE
and doesn’t affect query results) allows us to comment out any filter in the query without worrying about hanging AND
operators:
SELECT * FROM users WHERE 1 = 1 AND country = 'us' AND status = 'customer'
Formatting
We’ve talked about 4 aspects of SQL style guide:
- Naming. It’s really...