Search code examples
sqlt-sqlconventionsuppercaselowercase

What is POPULAR today when it comes to write SQL Queries: UPPER CASE or Lower Case?


What is POPULAR today when it comes to write SQL Queries: UPPER CASE or Lower Case? And for what specific reason?

SELECT * FROM tMyTable 

Or

Select * from tMytable

Solution

  • Either. Just be consistent

    Personally...

    Keywords uppercase for me, objects and datatypes in Normal or CapsCase.

    SELECT 
        M.Column1,
        CAST(O.Column2 AS int) AS IntColumn
    FROM
        MyTable M
        JOIN
        OtherTable O ON M.SomeKey = O.SomeKey 
    WHERE
        M.Column3 = 'bar'
    ORDER BY
        M.Column1
    

    It's easier to pick out the clauses of a complete SELECT query this way