Previous Page
Next Page

2.8. Some Conventions for Writing SQL Statements

Although SQL statements often contain multiple commands and multiple lines, there are no fixed rules for writing SQL statements; SQL is a "free-form" language. We suggest that you use the following conventions to increase the readability of your queries, especially as your statements or queries become more complex:

  • Use uppercase letters for the keywords, which inclues SELECT, FROM, and WHERE. Use lowercase letters for the user-supplied words (SQL Server is not case-sensitive for commands).

  • Align the keywords SELECT, FROM, and WHERE on separate lines, like this:

SELECT *
FROM   Dependent
WHERE  age > 5


Previous Page
Next Page