6

If I wanted to make a suggestion to a change to how the UPDATE statement works in SQL, how would I go about it?

Is there a website for the next standard?

I googled, but just kept getting the Wikipedia page.

Toby Allen
  • 397
  • 1
  • 11
  • 2
    SQL has been stable for years now, I don't think there will be a next standard – ratchet freak Jan 17 '13 at 11:39
  • 1
    Depending on the database you're using, what you're trying to accomplish can be achieved with triggers. Better would be to review your code and make sure there's a `WHERE` clause in statements that need them. – Blrfl Jan 17 '13 at 11:40
  • 2
    I understand your frustration with this accident, but advice you to get used to it like everyone else. Chances are very low your change would be considered, for the sake of backward compatibility. Also, current behavior is consistent (`DELETE FROM `). BTW, a standard might exist on paper, but in practice different implementations of it have slightly different syntax anyway. The last thing we'd want is that we'll have `ALL` in some but not all implementations, resulting in even more diverse behavior. So triggers or perhaps a good SQL editor that gives a warning.
    – Thijs van Dien Jan 17 '13 at 11:40
  • 1
    There already is a syntax that is explicit that you want to update everywhere: `update table set column=newvalue` **`where 1`**. Now it's just a matter of putting in a layer that will reject any update or delete statements without where into your database access layer (DAL). – Jan Hudec Jan 17 '13 at 12:02
  • @JanHudec the whole point is you don't need the where 1 if you leave it out its exactly the same. – Toby Allen Jan 17 '13 at 12:09
  • @TobyAllen: The whole point is that you can insert your own layer that can simply stop the later and you'll have the `where 1` when you really mean it. – Jan Hudec Jan 17 '13 at 12:35
  • 1
    "With a DELETE statement you know you are doing something destructive, but with an update statement the destruction happens by accident, not by design." - what? DELETE deletes, UPDATE updates, what's not to know? – AakashM Jan 17 '13 at 13:17
  • 1
    What about backwards compatibility!!! This will cost me $$$Million$$$$$!!! – Morons Jan 17 '13 at 14:06
  • Why not require you to put modification statements in a transaction and only after you've run a backup? – JeffO Jan 17 '13 at 14:56
  • Meanwhile, large DB vendors don't even bother to add a boolean datatype... – marcus Jan 17 '13 at 19:29
  • @AaKashM most update statements are designed to update a small portion of a table or a single row. This is a constructive rather than destructive verb. Leaving something out (the where clause) causes the UPDATE statement to be DESTRUCTIVE. Why should we not try to make stuff better! – Toby Allen Jan 18 '13 at 20:09
  • @TobyAllen that's true of most DELETE statements too; I'm not sure your constructive vs destructive idea goes anywhere (and in any event, doesn't an UPDATE always *destroy* the previous value?); and if you're going to propose a change you need to at least consider how much existing code you're going to break... – AakashM Jan 21 '13 at 09:27

2 Answers2

8

There are a couple of means to do this.

  1. Petition ISO
  2. Persuade your favorite DB vendor
  3. Make the change yourself

Petition ISO
You can petition your request to the appropriate committee(s) at ISO. The Wikipedia article you linked provides the ISO specification numbers and therefore which committees.

Be forewarned that you'll probably need to volunteer on the committee(s) and / or put in a lot of work to champion this change. Having indirectly worked with standards committees before, I can assure you that nothing is straightforward and nothing occurs unless the change has a champion.

Persuade your favorite DB vendor
The DB vendors such as IBM, Microsoft, and Oracle are not obligated to code their databases against the SQL standard. Last I checked, none of them complied completely with the latest SQL standard anyway. If you have sufficient clout with the vendors, you may be able to persuade them to implement the change you are requesting. I would start with your local sales representative in this case.

All of the major DB vendors are (or should be) involved in the standardization process. If you can convince one of them to make the change for you, then they should be able to champion the change at the next evolution of the standard.

Make the change yourself
All that having been said, you're more than welcome to pull a copy of the source for your favorite open source DBMS and make the change yourself. While this will likely require the most amount of effort on your part, it also has the best odds of actually seeing the light of day. Even if the project maintainers reject your enhancement, you can always run your version of the database and have the change you have requested.

If your change is adopted by the project and it proves popular, it could eventually find its way into the next version of the standard.

1

Well that standards are controlled by ANSI, so I would suggest you start there.

http://www.ansi.org/

Although as already said getting it in to the standards is unlikely, as mentioned from others there are ways of doing this already if you want to be explicit and more importantly your change wouldn't be backwards compatible.

A. Gilfrin
  • 121
  • 3