This DELETE command is executed:
DELETE FROM t1 ORDER BY b.a DESC LIMIT 2;
Which set of rows will be deleted by the command?
A.
(7,1) and (1,4)
B.
(2,8) and (1,4)
C.
(7,1) and (10,8)
D.
(2,8) and (10,8)
This DELETE command is executed:
DELETE FROM t1 ORDER BY b.a DESC LIMIT 2;
Which set of rows will be deleted by the command?
A.
(7,1) and (1,4)
B.
(2,8) and (1,4)
C.
(7,1) and (10,8)
D.
(2,8) and (10,8)
I think is the A
A is correct. Only column a is ordered by DESC.
My results gave me:
A | B
—–
2 | 8
10| 8
which means A is correct since 7,1 & 1,4 were deleted.
create table q45
(
a int(3),
b int(3)
);
insert into q45(a,b)
values(7,1),(2,8),(1,4),(10,8);
delete from q45 order by b,a desc limit 2;
select * from q45;
A
A
Column B will be ASC order and Column A will be in DESC ORDER.
for example:
B A
————-
1 4
2 5
(3) (5)
(3) (4) – 4 Goes after 5 because its descending.
4 2
5 2
On duplicate B, A ORDER WILL BE DESC.
SO IT’S A.
you can write something like| ORDER BY a DESC,b DESC;
This way a and b will be in desc order.
But firstly a and if a have duplicates b will be desc.