SQL Interview Questions And Answers Part 62 | SQL questions for Product based companies

Опубликовано: 02 Апрель 2023
на канале: ItJunction4all
2,527
51

SQL Interview Questions And Answers Part 62

Players Table contains the group of each player in which they belong to. Match table contains details of the match played. The winner in each group is the player who scored the maximum total points within the group. In the case of a tie, the lowest player_id wins.
You can assume that, in each match, players belong to the same group.
Write an SQL query to find the winner in each group.


-------------------------------------------------------------------------
𝗝𝗼𝗶𝗻 𝗺𝗲 𝗼𝗻 𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:🔥
-------------------------------------------------------------------------
*Instagram :
  / itjunction4all  

*Twitter:
  / sunilkr5672  
-------------------------------------------------------------------------
Table and Insert SQL Script :
-------------------------------------------------------------------------
Create table Players
(player_id int,
group_id int);

insert into players values (15,1);
insert into players values (25,1);
insert into players values (30,1);
insert into players values (45,1);
insert into players values (10,2);
insert into players values (35,2);
insert into players values (50,2);
insert into players values (20,3);
insert into players values (40,3);

create table Matches
(
match_id int,
first_player int,
second_player int,
first_score int,
second_score int);

insert into matches values (1,15,45,3,0);
insert into matches values (2,30,25,1,2);
insert into matches values (3,30,15,2,0);
insert into matches values (4,40,20,5,2);
insert into matches values (5,35,50,1,1);


#FAANG #SQLInterviewQuestionsandanswers #sqlInterviewQuestions #sqlInterviewQuestionsForTesting


Смотрите видео SQL Interview Questions And Answers Part 62 | SQL questions for Product based companies онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь ItJunction4all 02 Апрель 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 2,52 раз и оно понравилось 5 людям.