Search code examples
sqlconventions

Is there a common code convention for SQL in general or for specific SQL flavors?


As a contractor I'm exposed to several different code bases and I've noticed that while JAVA, .NET and PHP have code conventions with several degrees of adoption , SQL seems to vary a lot in the form it's written and generated not only from company to company but sometimes inside the same company.

Even languages such as HTML and CSS have widely referenced conventions, maybe not official , but well-know for being used major companies.

While I understand it might be difficult to create a industry accepted Ansi-SQL convention due to variance in SQL language implementantion , but I couldn't find a formal , community or company created convention even for specific RDBMS Sql flavors like TSQL or PL/pgSQL.

by code-convention I mean documents such

https://google.github.io/styleguide/jsguide.html

http://www.oracle.com/technetwork/java/codeconventions-150003.pdf

https://www.php-fig.org/psr/


Solution

  • Each database engine works a little differently because the SQL naming conventions depend on the specific server.

    There are also attempts to determine it "code convention for SQL", e.g. https://www.sqlstyle.guide/