+ 1
Can any one tell me result in this delete statement
I have a table called table1 contains id column values like 1 to 10, another table table2 contain iid column values like 5 to 15 now my query is delete from table1 where id in(select id from table2) so what is the out come of this query thanks in advance
8 Respuestas
+ 1
ok i will share answer first the error, table2 doesn't have id column table2 has iid column, but when you run this query in sql server you can't get the error because sql ignores sub query error and executes the query successfully but result is table1 rows will Delete entirely not from rows id 5 to 10 thanks for the answers
0
from table1 rows from ID 5 to 10 will be deleted
0
sorry your answer is wrong please re read the question exactly as it is and try again
0
hello @ manasa please run the script as it is and create table exactly as in the question and tell me the answer I know the answer exactly because I did it that's why and before down vote any answers make sure you know perfect result
0
there is an error in the query but we can't get error in SQL express, SQL ignores the error and executes the query this is an hint because you guys don't know how to read question exactly as it is.
0
@manasa I didn't edited question that's why I keep telling from beginning read question exactly as it is. and as our mind set we skip extra "I" and we read just id, I did this wrong query in a live database more than 2000 data has lost so then only I found the error that's why I posted here so if any one thinks this is useful then they don't make the error as I did
0
for general info before you write delete query first write select then change it to delete so u can know exactly what data is going to delete ex:
select * from table where obtainmarks >59
execute it and
then change it to
delete from table where obtainmarks >59
now u know which data is going to delete for sure
0
id's from 5 to 10 r deleted