Click here to Skip to main content
15,867,986 members
Home / Discussions / Database
   

Database

 
GeneralRe: TSQL, Order by case, and I need to order by version Pin
jkirkerx23-Mar-23 9:03
professionaljkirkerx23-Mar-23 9:03 
QuestionSQL where clause variability up against coding standards Pin
Brian L Hughes10-Mar-23 15:59
Brian L Hughes10-Mar-23 15:59 
AnswerRe: SQL where clause variability up against coding standards Pin
Dave Kreskowiak11-Mar-23 5:37
mveDave Kreskowiak11-Mar-23 5:37 
AnswerRe: SQL where clause variability up against coding standards Pin
Eddy Vluggen11-Mar-23 9:00
professionalEddy Vluggen11-Mar-23 9:00 
AnswerRe: SQL where clause variability up against coding standards Pin
jschell13-Mar-23 6:56
jschell13-Mar-23 6:56 
AnswerRe: SQL where clause variability up against coding standards Pin
jsc4223-Mar-23 7:32
professionaljsc4223-Mar-23 7:32 
GeneralRe: SQL where clause variability up against coding standards Pin
Brian L Hughes23-Mar-23 14:52
Brian L Hughes23-Mar-23 14:52 
GeneralRe: SQL where clause variability up against coding standards Pin
jsc4227-Mar-23 23:00
professionaljsc4227-Mar-23 23:00 
The phrase you are looking for is 'short circuiting'.

https://stackoverflow.com/questions/789231/is-the-sql-where-clause-short-circuit-evaluated[^] quotes an SQL standard that says
ANSI SQL Draft 2003 5WD-01-Framework-2003-09.pdf

6.3.3.3 Rule evaluation order

[...].
Where the precedence is not determined by the Formats or by parentheses, effective evaluation of expressions is generally performed from left to right. However, it is implementation-dependent whether expressions are actually evaluated left to right, particularly when operands or operators might cause conditions to be raised or if the results of the expressions can be determined without completely evaluating all parts of the expression.

I have not found any specific answer for MySql but IIRC MySql gives you a choice of engines so it might depend on the engine.

The answer for MS SQL SERVER (according to Understanding T-SQL Expression Short-Circuiting – SQLServerCentral[^]) is that short circuiting does happen (but that is specific to that one environment).

It is easy to test. If you have a WHERE clause like
SQL
WHERE NULL = NULL OR 1/0 = 1
then it will deliver TRUE if short circuiting is implemented and throw an error (trying to divide by zero) if not implemented.
GeneralRe: SQL where clause variability up against coding standards Pin
jschell28-Mar-23 6:23
jschell28-Mar-23 6:23 
QuestionCode: 1292 SQL State: 22007 --- Incorrect datetime value Pin
Siavash.BRY6-Mar-23 20:56
Siavash.BRY6-Mar-23 20:56 
AnswerRe: Code: 1292 SQL State: 22007 --- Incorrect datetime value Pin
Richard MacCutchan6-Mar-23 21:26
mveRichard MacCutchan6-Mar-23 21:26 
GeneralRe: Code: 1292 SQL State: 22007 --- Incorrect datetime value Pin
Siavash.BRY6-Mar-23 21:52
Siavash.BRY6-Mar-23 21:52 
GeneralRe: Code: 1292 SQL State: 22007 --- Incorrect datetime value PinPopular
Richard MacCutchan6-Mar-23 22:09
mveRichard MacCutchan6-Mar-23 22:09 
AnswerRe: Code: 1292 SQL State: 22007 --- Incorrect datetime value Pin
jschell8-Mar-23 7:03
jschell8-Mar-23 7:03 
AnswerRe: Code: 1292 SQL State: 22007 --- Incorrect datetime value Pin
RedDk8-Mar-23 8:30
RedDk8-Mar-23 8:30 
QuestionEF Core 6 Question Pin
Kevin Marois1-Feb-23 16:24
professionalKevin Marois1-Feb-23 16:24 
AnswerRe: EF Core 6 Question Pin
Dave Kreskowiak2-Feb-23 2:34
mveDave Kreskowiak2-Feb-23 2:34 
GeneralRe: EF Core 6 Question Pin
Kevin Marois2-Feb-23 5:45
professionalKevin Marois2-Feb-23 5:45 
Questionexecute an update  using --> "Exec sp_executesql @Sql1" Pin
Member 115338921-Feb-23 4:55
Member 115338921-Feb-23 4:55 
AnswerRe: execute an update  using --> "Exec sp_executesql @Sql1" Pin
Victor Nijegorodov1-Feb-23 5:48
Victor Nijegorodov1-Feb-23 5:48 
AnswerRe: execute an update  using --> "Exec sp_executesql @Sql1" Pin
David Mujica2-Feb-23 4:31
David Mujica2-Feb-23 4:31 
AnswerRe: execute an update  using --> "Exec sp_executesql @Sql1" Pin
Eddy Vluggen10-Mar-23 12:17
professionalEddy Vluggen10-Mar-23 12:17 
QuestionQuestion On SQL Query Result Pin
crmfghtr20-Jan-23 5:13
crmfghtr20-Jan-23 5:13 
AnswerRe: Question On SQL Query Result Pin
Richard Deeming20-Jan-23 5:33
mveRichard Deeming20-Jan-23 5:33 
PraiseRe: Question On SQL Query Result Pin
crmfghtr20-Jan-23 5:41
crmfghtr20-Jan-23 5:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.