Showing posts with label SQL Controversy. Show all posts
Showing posts with label SQL Controversy. Show all posts

Monday, July 09, 2007

SQL Controversy: Capitalizing Keywords

Do you write code like this?

set ROWCOUNT 10
select Products.ProductName as TenMostExpensiveProducts, Products.UnitPrice
from Products
order by Products.UnitPrice desc

Or like this?

SET ROWCOUNT 10
SELECT Products.ProductName AS TenMostExpensiveProducts, Products.UnitPrice
FROM Products
ORDER BY Products.UnitPrice DESC


Do we need to capitalize the keywords, functions and statements when we have syntax coloring built into the product?
Look if you use SPUFI with DB2 I understand (see image below)






Here is another example this time without color.


set ROWCOUNT 10
select Products.ProductName as TenMostExpensiveProducts, Products.UnitPrice
from Products
order by Products.UnitPrice desc


SET ROWCOUNT 10
SELECT Products.ProductName AS TenMostExpensiveProducts, Products.UnitPrice
FROM Products
ORDER BY Products.UnitPrice DESC

And yes I agree the bottom query is much easier to read

But with syntax coloring do you still need this? It is a big pain in the neck to use that CapsLock/Shift key every time you type a keyword. There are tools of course like SQL Formatter which will make it much easier.
Remember Hungarian notation, In VB you would write sLastName(string), iCounter(integer)? Well that is gone also, who needs it when you have IntelliSense?
I think the lowercase sql code is easier on the eyes. So what do you think?