-16

I would like you to put yourself in the OP's position having asked this question. Another user voted to close this question and it had two close votes. I fixed this question up and answered it myself. The user who voted to close it rolled it back to a form which they had previously voted to close. This seems malicious even. Which of these two behaviors do you think will make for a more hospitable environment for the OP?

The core of the question was pretty sound but badly worded,

Title: SQL add column: ADD or ADD COLUMN...which is best practice?

Is either ADD or ADD COLUMN considered best practice, or are they equivalent? [...] with a view to longer-term support for other databases, should either syntax be preferred now?

This is subjective. To make it objective I tagged it with [ansi-sql] and turned it into,

Title: Is the COLUMN keyword optional in ANSI SQL?

Both syntaxes work in MS Access 97 and SQLite3. Is COLUMN required and which is preferred?

The goal being to address the cross-database support through the SQL standard. Please examine this edit transaction here. I think my edit should be chosen, https://stackoverflow.com/posts/71157875/revisions

10
  • "This seems malicious even." *coughcoughcough*
    – E_net4
    Feb 28, 2022 at 17:43
  • "he user who voted to close it rolled it back, to a form which they had previously voted to close." - They only voted to close the question, it would have required 4 additional users, to close the question. I am not sure I see the connection to the close vote and the edit rollback. Feb 28, 2022 at 17:44
  • @SecurityHound because after I told the user who voted to close the question that I had edited the question instead, he came back and reverted the edit to a form he wanted to close. Without any further attempt to refine the question to help the OP. Feb 28, 2022 at 17:46
  • 2
    @NOWARWITHRUSSIA - TylerH thought you went beyond your role of an editor and changed the intent of the question. It is their prerogative to think that. You seem to be taking an edit reversal extremely personally unnecessarily. I suppose it does not matter the question has now been edited. The current revision is far superior to your edit proposal or the original revision. Feb 28, 2022 at 17:51
  • 2
    I believe the edit you made was an improvement. I can also understand the POV of someone like TylerH who thought that you were changing the meaning. I don't think your edit changed the meaning, but it was a bit too much. The question is asking which one should be preferred, not whether the COLUMN keyword is mandatory. TylerH must have seen the question in a review queue and in its original form it looked to be asking purely for opinions.
    – Dharman Mod
    Feb 28, 2022 at 17:51
  • @Dharman we stay away from "preferences," it's subjective. It's not about my preference. What is preferred is what the spec says so long as your database is sufficiently spec-compliant. Feb 28, 2022 at 17:54
  • 13
    As an aside: "Which of these two behaviors do you think will make for a more hospitable environment for the OP?" This is not the topic. We are not here to make question-askers feel warm and cosy. We care only about the usefulness of the content. None of us interacted with the OP to make them feel unwelcome. We only interacted with the content that they shared with the world.
    – Dharman Mod
    Feb 28, 2022 at 18:01
  • "We are not here to make question-askers feel warm and cosy." I disagree with that. The code of conduct explicitly mentions it "If you’re here to help others, be patient and welcoming." You know what's not welcoming? Closing a question which can be easily salvaged and answered. I know exactly 100% what that OP was trying to ask, and I'm sure any other SME or DBA/professional would too. And it's certainly not welcoming to rollback a question to a form that preserves your close-vote without any attempt to salvage. That's the least welcoming thing you can do. Feb 28, 2022 at 18:06
  • You changed the meaning, that is not appropriate.
    – philipxy
    Mar 2, 2022 at 0:49
  • Just leaving this here.
    – E_net4
    Mar 3, 2022 at 9:57

2 Answers 2

7

The SQL syntax is often confusing, especially when it comes down to its different flavours and syntax differences. The fact that both ADD and ADD COLUMN work does not say anything about which one should be chosen or why there are two variants in the first place.

I believe this question is on-topic, but it was poorly worded. It can very easily be understood to mean "which one you like better". OP is looking for a fact-supported answer explaining the reason for the existence of both variants. If one of them is a proprietary syntax, then it would explain which one should be used when someone is thinking of supporting multiple databases, both old and new.

1
  • 2
    I am the OP. @Dharman here best captures my intention. I'm an experienced developer, but new to SQL. I've inherited an application that supports a database long obsolete (Access 95/97) and another database which is brand new (SQLite3 v3.37.0). With a view to future database support, and what experts in SQL consider best practice, are there any facts supporting a preference (such as performance, more widespread support and so on). NoWarWithRussia made a poor edit to the question, completely changing its' meaning, though his answer was fine.
    – AlainD
    Feb 28, 2022 at 21:31
3

The question isn't asking anything specific about why there's a difference in behavior; the OP indicates that they see that both work.

They're asking which is preferred from a stylistic perspective. That is to say, as they're going through their SQL, they're looking to either update their usage of adding columns to either ADD or ADD COLUMN.

This...should be closed as subjective. This is no different than someone picking an indent level in a markup language that doesn't honor it, or someone putting their curly braces on the next line instead of at the end of the line.

14
  • 1
    I don't agree here. The op said "with a view to longer-term support for other databases" that isn't merely stylistic. That's getting to he wants to do what the spec says and not infer based on the implementation. (I didn't have that above quote in my question so I did add it, and I didn't downvote you). Feb 28, 2022 at 17:38
  • That's asking us to predict the future. If they just wanted to know what the spec says, they can go read it.
    – Kevin B
    Feb 28, 2022 at 17:39
  • @KevinB - Which we cannot do. Feb 28, 2022 at 17:40
  • We can't predict that future implementations are more likely to follow a spec than not? And, that by asking for future-safety we can answer by the word of the spec? What? Are you in the industry? Feb 28, 2022 at 17:43
  • @NOWARWITHRUSSIA: Then they should go read the spec. We're not going to keep the spec up to date for them.
    – Makoto
    Feb 28, 2022 at 17:45
  • @Makoto We have a tag for the spec for a reason. This is quite common. As a matter of fact, we do help users navigate and understand the SQL spec. I'm unsure if this answer amounts to a request to not do that, but we do. Feb 28, 2022 at 17:47
  • So once again I say @NOWARWITHRUSSIA, how is this different than if someone put a curly brace at the end of a line versus at the beginning of their next line? The spec allows this, and if the spec needs to change to enforce one style over another, why is it then Stack Overflow's responsibility to maintain that?
    – Makoto
    Feb 28, 2022 at 17:49
  • It's not StackOverflow's responsibility to do anything. We're here to help people who ask questions. People ask questions on the spec. People ask questions that the spec can inform. If you want to help them, you do it. If you don't, don't. Specs change, and technology changes too. But to pretend like a spec has no value because it can change seems absurd. Feb 28, 2022 at 17:51
  • 4
    "They're asking which is preferred from a stylistic perspective." That is definitely not what they are asking. Style has nothing to do with the syntax. They might have tested that both work in the database they currently have on hand, but one could be a legacy syntax that is still supported, or one of them could be a brand new syntax that isn't supported by older databases. They want reliable information about the recommended standard syntax that works in all SQL flavours.
    – Dharman Mod
    Feb 28, 2022 at 18:04
  • I am the OP. I was not asking about stylistic preference, though you are correct about trying to understand whether my statements should be ADD or ADD COLUMN with a view to supporting multiple databases. This interpretation of the question is incorrect. Dharman and NoWarWithRussia interpreted the question more closely to my original intention (see my comment to @Dharman's answer).
    – AlainD
    Feb 28, 2022 at 21:34
  • @AlainD I believe you that this is what you intended, but reviewers and other readers can only judge and interpret what you write down, not what is in your head. The title already said "what is best practice?" - it is almost like you were fishing for triggers. Most people reserve that for the question body so it can be eased in a little more (and even then I can't recommend using that phrase, just don't).
    – Gimby
    Mar 1, 2022 at 15:09
  • @Gimby: Sure, maybe the question wasn't phrased perfectly. It was clear in my mind and I didn't expect this storm-in-a-teacup. Some people (Dharman, for example) interpreted the question correctly. There are over-zealous reviewers on this and other technical sites who literally start from the point-of-view that the OP is an idiot (or variations thereon). To foster an environment where engaged, intelligent and long-term users, like me, feel welcome and learn to improve, it would be helpful if these reviewers would take a moment to reflect...(I won't be holding my breath).
    – AlainD
    Mar 1, 2022 at 18:51
  • 1
    @AlainD - The reviewers were absolutely not over-zealous. As a long time user, you probably should reflect on the fact, your question wasn’t clear by the fact there were so many opinions about such a simple edit. A good compromise leave’s everyone sort of happy. Mar 2, 2022 at 12:40
  • @SecurityHound: And you're wading in why exactly? The reviewers changed the meaning of the question, ergo they are over-zealous. The linked question is not appropriate in at least two ways. If you're going to edit a question, you have to at least understand it to improve it. Dharman did. The reviewers neither understood it (yes my bad and I have reflected on this, but their bad too) nor did they improve it (all their bad). The question is now closed and (incorrectly) linked it to a tangentially-related question. No need to respond. Just let it rest and let's move on.
    – AlainD
    Mar 3, 2022 at 12:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .