Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You
1–10 of 18 posts
Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You
#2EDIT:" For people who think I don't know what they mean, I do. I meant that the author of TFA obviously meant to write "Nondeterministic Functions in MySQL (e.g. Rand)", because the entire article is about all non-deterministic functions and just uses rand as an example.
Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You
#3Why do people use "i.e." instead of "e.g."? EDIT:" For people who think I don't know what they mean, I do. I meant that the author of TFA obviously meant to write "Nondeterministic Functions in MySQL (e.g. Rand)", because the entire article is about all non-deterministic functions and just uses rand as an example.
Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You
#4Why do people use "i.e." instead of "e.g."? EDIT:" For people who think I don't know what they mean, I do. I meant that the author of TFA obviously meant to write "Nondeterministic Functions in MySQL (e.g. Rand)", because the entire article is about all non-deterministic functions and just uses rand as an example.
Why do people match salmon colored items with rose ones?
Why do people sing off key?
They aren't themselves sensitive to the difference and don't think about it.
Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You
#5Why do people use "i.e." instead of "e.g."? EDIT:" For people who think I don't know what they mean, I do. I meant that the author of TFA obviously meant to write "Nondeterministic Functions in MySQL (e.g. Rand)", because the entire article is about all non-deterministic functions and just uses rand as an example.
"e.g." is "exempli gratia" in latin; just meaning "for example".
Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You
#6Why do people use "i.e." instead of "e.g."? EDIT:" For people who think I don't know what they mean, I do. I meant that the author of TFA obviously meant to write "Nondeterministic Functions in MySQL (e.g. Rand)", because the entire article is about all non-deterministic functions and just uses rand as an example.
Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You
#7Why do people use "i.e." instead of "e.g."? EDIT:" For people who think I don't know what they mean, I do. I meant that the author of TFA obviously meant to write "Nondeterministic Functions in MySQL (e.g. Rand)", because the entire article is about all non-deterministic functions and just uses rand as an example.
well in this case they only really talk about the one function so i.e. is not incorrect.
Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You
#8 select * from some_table
join (select rand() as random_id) on
some_table.the_id = random_id
This way it is obvious that rand() will be evaluated only once.Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You
#9SELECT * FROM SomeTable WHERE ID = CAST(Rand() * 1000 as int)
In addition this query: SELECT TOP(100) rand() AS RandData from SomeTable
Returns: 0.940284064056996 0.940284064056996 0.940284064056996 . . . .
A old trick to actually get random data on SQL Server that I think has been replaced with newer functionality is:
SELECT ABS(CHECKSUM(NEWID())) FROM SomeTable
However if we move the NEWID.... stuff into the WHERE clause we end up switching to an index seek so back to being evaluated once.