AMAZON Interview Question | SQL Intermediate Question 9
HTML-код
- Опубликовано: 12 дек 2023
- QUESTION - Remove all the reversed pair from the given table.
DDL Command :-
drop table tb1;
create table tb1(n int , m int);
insert into tb1
values(1,2),(2,3),(3,4),(2,1),(3,2),(5,6);
select * from tb1;
#amazon #netflix #google #microsoft #flipkart #sqldeveloper #dataanalytics #dataengineering #sqlserver #interviewquestions #ml #ai
Great work pls keep posted this type of interview questions
select * from (
select *,ROW_NUMBER() over(partition by flagtab.concat order by n) as flag from (
select *,
case when n>m then CONCAT(n,m) else CONCAT(m,n) end as concat
from tb1) as flagtab)as new where new.flag=1