SQL TUTORIAL • LESSON 26, Tips & Tricks
Formatting best practices
You can pretty well format your code as you like — capitalized letters, spaces, indents, and line breaks don’t influence the result in SQL. This is great, because it means you can use your formatting to make your code easier to read. There are different conventions for how to structure your code, and you might develop your own style. But here are some suggestions of how to best format your code:
- Field names and functions should be lowercase
- When using alias use the ‘as’ keyword
- Use line breaks & indents to make your code more readable
- Have space after a comma and on both side of operators
- Use preceding commas