0

now I am write some sql in my rust code, I was wondering is it a standard SQL format with PostgreSQL? I have already searching from google but seems no one care about it, for example in Oracle, prefered to use UPPERCASE, for example, this sql:

select * from foo;

what should I write it?

SELECT * FROM foo;
select * from foo;
SELECT * FROM FOO;

which one is better or prefer?

0

1 Answer 1

1

There is no standard and different people have different preferences. My suggestion would be to pick a format and then be consistent in using it. Also, try nor to name any tables, columns, etc. such that you need to quote the identifiers in order to use them. – user6393

Just remember that code formatting is all about clarity and communication. Anything that obfuscates or makes people hop through unnatural hoops is bad. Anything that adds to the clarity is good. Focus there and you'll be OK. - user6597

Keywords are case-independent. Object names can be both sensitive and not, depends on DBMS and (in some DBMSs) on object quoting and some other settings. – user150107

If in doubt go with the convention used in the manual: SQL keywords in upper case, identifiers in lower case. – user3684

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.