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?

asked Mar 23, 2022 at 11:20
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

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.