5 ms·
I always thought that it's a very strange default in SQL: if you don't specify which rows you want, the operation affects everything.
by scotty79 9y ago
I always thought that it's a very strange default in SQL: if you don't specify which rows you want, the operation affects everything.
- GrumpyNl 9y agoIts is exactly doing what you tell it to do, update without filter, it updates all.
- yjftsjthsd-h 9y agoOne would expect to have to specify that with an asterisk or something and have blank just give a syntax error.
- mannykannot 9y ago...until one thinks it through and realizes that this would require that special value as an extra condition for every attribute in every relation mentioned in the query, which in turn would eliminate both the theoretical elegance of the relational model and the many very practical benefits that arise from it. A secondary problem is what to do if '*' is a valid value... Ad-hoc solutions are often more difficult than they first seem.
- aexaey 9y agoPercent, rather than asterisk. UPDATE t SET foo='bar' WHERE baz LIKE '$INPUT'; This will do no changes when $INPUT is empty, and only with $INPUT set to '%' will it update every record.
- JdeBP 9y agoAsk yourself how many search forms you have filled in where you are allowed to leave the fields that you are not searching on blank. That is a fairly common design.
- atkbrah 9y agoIt's like one of the most common user errors with cisco cli. When you want to add an interface to a vlan you would type: switchport trunk allowed vlan add $vlan But if you by accident omit add keyword you would replace all interface vlans with $vlan switchport trunk allowed vlan $vlan
- irishsultan 9y agoAt least in that case the important keyword isn't placed at the end (i.e. you would get an error if you merely typed ` switchport trunk allowed vlan add`)
- aexaey 9y ago...and, if especially unlucky, that would be the trunk you're using to connect to that switch.
- kazen44 9y agoWhich is why you usually have a seperate OOB network for logging into switches and routers. If it's very mission critical, even an entire seperate cable infrastructure for OOB is not uncommon.
- deleted 9y ago[deleted]
- pbhjpbhj 9y agoIIRC that's like "groupadd" on Linux distros, if you don't add a switch it replaces all that users groups.