March 4, 2015 at 8:24 pm
Comments posted to this topic are about the item Remove data from tables
--------------------------------------
;-)βEverything has beauty, but not everyone sees it.β β Confucius
March 4, 2015 at 8:25 pm
I suspect answer D (one of the correct ones) needs to be "DELETE FROM" rather than "DELETE TABLE".
Cheers,
- Mark
March 4, 2015 at 8:56 pm
The "delete table BBB;" statement in d) will fail.
March 5, 2015 at 12:00 am
Got Lucky as I chose (d) where no other possible option is left!! π
Thanks for the question.. Often I use the similar queries in our pre-production environment to generate new records... π
______________________________________________________________Every Problem has a Solution; Every Solution has a Problem: π
March 5, 2015 at 12:17 am
"Delete table" is not a correct syntax in option d.
Correct and is option c and f.
Thanks,
Divya.
March 5, 2015 at 1:43 am
I only marked option F). Option D) has a wrong syntax. It should be delete from BBB; delete from AAA;
March 5, 2015 at 1:59 am
Same as, D would not work so my answer of F is then correct π
March 5, 2015 at 2:04 am
Jostein Saethern (3/4/2015)
The "delete table BBB;" statement in d) will fail.
Its just a typo.
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
March 5, 2015 at 2:08 am
divu.17 (3/5/2015)
"Delete table" is not a correct syntax in option d.Correct and is option c and f.
Thanks,
Divya.
C is not correct, cause you can`t delete any rows from table AAA until first you delete all referenced rows in table BBB.
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
March 5, 2015 at 2:09 am
Nice question, unfortunately poorly implemented.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
March 5, 2015 at 2:10 am
Hany Helmy (3/5/2015)
Jostein Saethern (3/4/2015)
The "delete table BBB;" statement in d) will fail.Its just a typo.
That's not a typo, that is a mistake.
DELETE FRAM BBB, that is a typo.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
March 5, 2015 at 2:27 am
Even ignoring the typo/mistake, the explanation is totally wrong. It is nothing to do with whether the statements are logged, and it is common incorrect) myth that TRUNCATE TABLE is not logged. I'm slightly surprised that this misleading assertion slipped through the net.
The reason that none of the TRUNCATE AAA statements will work is that you cannot truncate a table that is referenced by a foreign key. This is true irrespective of whether there is any data in it - you can verify this by simply creating the tables, not populating them, and trying to TRUNCATE TABLE AAA.
March 5, 2015 at 2:28 am
Toreador (3/5/2015)
Even ignoring the typo/mistake, the explanation is totally wrong. It is nothing to do with whether the statements are logged, and it is common incorrect) myth that TRUNCATE TABLE is not logged. I'm slightly surprised that this misleading assertion slipped through the net.The reason that none of the TRUNCATE AAA statements will work is that you cannot truncate a table that is referenced by a foreign key. This is true irrespective of whether there is any data in it - you can verify this by simply creating the tables, not populating them, and trying to TRUNCATE TABLE AAA.
+1
March 5, 2015 at 3:11 am
No such command as "DELETE TABLE". I thought that was the catch so went for the two truncates (against my better judgement). There was only one correct answer.
March 5, 2015 at 4:16 am
Why the b) choice ( truncate BBB , delete AAA ) is not correct ?
It seems for me that as soon as there is no more rows in the BBB table , it is possible to execute a truncate or delete on the table AAA.
Maybe , I have missed something about the behaviour of truncate/delete in case of foreign key.
According to me , the b , d , f choices are correct. Always do a delete/drop on the BBB table with the foreign key before do a delete/drop on the AAA table.
Or , I have misunderstood the meaning of the b choice ( I recognized that my English understanding is far to be good ).
Have a nice day
Viewing 15 posts - 1 through 15 (of 51 total)
You must be logged in to reply to this topic. Login to reply