Best practices for naming "State" field [closed] - sql

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
When a U.S. address is stored, obviously it needs to have the state stored as well. The issue is that the word "State" is a reserved keyword in SQL.
What else should this be named? Are there any alternatives or do people just deal with having to wrap it in square braces?

Personally we prefer to use State as the property name and wrap it in queries or anywhere else there may be reserved word conflicts. We have not had any issues with this in the 3 years I have been on the team. Hope that helps!

Related

PostgreSQL - cast to character(1) vs like [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
What has better (faster) performance?
mycolumn::character(1)='4' or mycolumn like '4%'
where mycolumn is text or character(200)
It is often quite simple to do these tests yourself to see which is faster.
As a general rule, though, like with constants starting the pattern is index-friendly. That means that it would generally be the preferred solution.
Even without an index, like appears to perform better, as this example in db<>fiddle shows. Of course, working on this artificial data does not mean that it would have the same performance characteristics on your data.

Suggested format for SQL statement [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I've always struggled with how to format SQL queries in terms of whitespace, alignment, etc. It seems whenever there is an "auto-formatter" it seems to format things differently than the next one, whether it is within a SQL client or a website or text-editor that does various language formatting. Are there any guideline(s) for how SQL should be formatted for best readability? Here is an example of how I currently do it:
SELECT
name
FROM
sales_instance si
JOIN main_iteminstance i ON si.instance_id=i.id
ORDER BY
name
Also, yes I know this may be 'opinion-based' and people may want to close it for that, but I think this answer is helpful as to writing clean SQL and hopefully someone can provide a good summary of the available formats or guidelines.

When pronouncing variable-names-like-this, why do all programmers say dash instead of hyphen? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
After doing some research, I believe these are hyphens, not dashes. However all programmers I met say dashes. Is there a reason? If I keep saying hyphen hyphen hyphen, would I sound weird?
Because it’s easier to say. “Dash dash dash” vs. “hyphen hyphen hyphen”. One of those is a mouthful.
Same as saying “dot” instead of “period” in URLs and IPs.

What are good naming conventions for linking tables [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
What is a good naming convention for naming linking tables? I have a school project and we are modifying the orig data for the project.
Not sure what language you're going for here, but you can try database naming conventions. This link may help you decide.
http://efsavage.com/blog/posts/database_naming_conventions/

What's the Necessary Items to Document on code? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
There is so many option in each programming languages which can be mentioned in the code documentation.
I want to know what are the most important Items which we have to document?
I'd document contracts (this parameter is expected not to be null, this function never returns null, ...) as well as the meaning (this method does that, ...). Besides documenting the API, I'd add comments on pieces of code which are non-trivial but add a significant value to the application (cryptic but real fast, works around a framework bug).
What you document ultimately depends a lor on who will read that documentation...