December 18, 2010 at 3:23 pm
Comments posted to this topic are about the item NULL Values and Joins
December 18, 2010 at 11:49 pm
I accept I got it wrong, but what do you mean the second transaction fails? Only the insert null into the primary key field statement fails. There are no failed inserts on Table2.
December 19, 2010 at 6:37 am
Nice question, but only 1 point?
Transactions and the NULL insert in the primary key have actually nothing to do with the actual question, they just serve as trickery in my opinion.
And I don't really get the last line of the explanation. B not C is the correct answer?
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
December 20, 2010 at 1:26 am
This was removed by the editor as SPAM
December 20, 2010 at 1:32 am
No rows were inserted into table2? B not C is the correct answer? Terrible, terrible explanation 🙂
December 20, 2010 at 1:40 am
vk-kirov (12/20/2010)
No rows were inserted into table2? B not C is the correct answer? Terrible, terrible explanation 🙂
The explanation is more terrible than the question: I should read it at least 7 times!
:-D:-D:-D:-D:-D:-D:-D
December 20, 2010 at 2:17 am
I have to disagree with the answer. I ran the code on SQL server 2005 and got the following output:
abcd
4join14join2
4join14join2
2join32one
2join32one
1oneNULLNULL
NULLNULLNULLtwo
NULLNULLNULLthree
As I had worked out the same output before running and answering the question I decided that A, B, D and E could not possibly be correct so went for C as the only remaining option.
What have I missed?
December 20, 2010 at 2:26 am
philip.cullingworth (12/20/2010)
I have to disagree with the answer. I ran the code on SQL server 2005 and got the following output:
abcd
4join14join2
4join14join2
2join32one
2join32one
1oneNULLNULL
NULLNULLNULLtwo
NULLNULLNULLthree
As I had worked out the same output before running and answering the question I decided that A, B, D and E could not possibly be correct so went for C as the only remaining option.
What have I missed?
Your output has 7 rows and the column d contains "three" for the 7th row, so it should be answer D.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
December 20, 2010 at 2:35 am
da-zero (12/20/2010)
Your output has 7 rows and the column d contains "three" for the 7th row, so it should be answer D.
But Answer D is
7 rows where column d = three
I only have 1 row where column d = three :ermm:
December 20, 2010 at 2:45 am
philip.cullingworth (12/20/2010)
da-zero (12/20/2010)
Your output has 7 rows and the column d contains "three" for the 7th row, so it should be answer D.But Answer D is
7 rows where column d = three
I only have 1 row where column d = three :ermm:
Please, read carefully the question: it asks how many rows are in the results and what is the value of column "d" on the last row.
December 20, 2010 at 3:19 am
Carlo Romagnano (12/20/2010)
Please, read carefully the question: it asks how many rows are in the results and what is the value of column "d" on the last row.
:blush: That will teach me. I read the code and assumed what the actual question would be. Can I blame being up in the middle of the night defrosting water pipes?
December 20, 2010 at 3:24 am
philip.cullingworth (12/20/2010)
But Answer D is7 rows where column d = three
I only have 1 row where column d = three :ermm:
I had read the answers several times before I realized there were some skipped words: "7 rows where [the value of] column d [in the last row] = three" :hehe:
December 20, 2010 at 3:54 am
I don't understand how the first transaction could succeed given the attempt to insert the null value into the not-null field "a". Also, why is the last insert of the second transaction, VALUES(2 ,'one'), invalid? Help, I'm confused.
December 20, 2010 at 3:57 am
ian.grace (12/20/2010)
I don't understand how the first transaction could succeed given the attempt to insert the null value into the not-null field "a". Also, why is the last insert of the second transaction, VALUES(2 ,'one'), invalid? Help, I'm confused.
As posted above by vk-kirov and others, the explanation is terrible with a lot of mistakes.
December 20, 2010 at 4:06 am
ian.grace (12/20/2010)
I don't understand how the first transaction could succeed given the attempt to insert the null value into the not-null field "a". Also, why is the last insert of the second transaction, VALUES(2 ,'one'), invalid? Help, I'm confused.
The first transaction succeeds because it is an explicit transaction. Those will only fail if you explicitly issue a ROLLBACK statement, which isn't the case. Since a COMMIT was issued, the 2 other INSERTS in the transaction are committed to the database.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 15 posts - 1 through 15 (of 41 total)
You must be logged in to reply to this topic. Login to reply