CASE12:need final list of passengers allowed to enter the lift based on the max capacity of the lift

Поділитися
Вставка
  • Опубліковано 5 лис 2024

КОМЕНТАРІ • 7

  • @gajasrikanth4242
    @gajasrikanth4242 5 місяців тому +1

    🎉❤🎉

  • @rajanikanthgaja2916
    @rajanikanthgaja2916  5 місяців тому +1

    insert into lift_passengers values ('Rahul', 85, 1);
    insert into lift_passengers values ('Adarsh', 73, 1);
    insert into lift_passengers values ('Riti', 95, 1);
    insert into lift_passengers values ('Dheeraj', 80, 1);
    insert into lift_passengers values ('Vimal', 83, 2);
    insert into lift_passengers values ('Neha', 77, 2);
    insert into lift_passengers values ('Priti', 73, 2);
    insert into lift_passengers values ('Himanshi', 85, 2);

  • @Tejasri15150
    @Tejasri15150 5 місяців тому

    ❤️

  • @MusicalShorts-hn1px
    @MusicalShorts-hn1px 5 місяців тому

    Insert statement of lift_passengers table is missing

    • @rajanikanthgaja2916
      @rajanikanthgaja2916  5 місяців тому +1

      insert into lift_passengers values ('Rahul', 85, 1);
      insert into lift_passengers values ('Adarsh', 73, 1);
      insert into lift_passengers values ('Riti', 95, 1);
      insert into lift_passengers values ('Dheeraj', 80, 1);
      insert into lift_passengers values ('Vimal', 83, 2);
      insert into lift_passengers values ('Neha', 77, 2);
      insert into lift_passengers values ('Priti', 73, 2);
      insert into lift_passengers values ('Himanshi', 85, 2);

    • @rajanikanthgaja2916
      @rajanikanthgaja2916  5 місяців тому +1

      use this insert

  • @pradeepvadlakonda007
    @pradeepvadlakonda007 5 місяців тому

    select lift_id,group_concat(passenger_names) as passengers_name from
    (select l.id as lift_id,
    l.capacity_kg as lift_capacity,
    lp.passenger_name as passenger_names,
    lp.weight_kg,
    sum(lp.weight_kg) over (partition by lp.lift_id order by lp.lift_id,lp.weight_kg) as running_total
    from lifts l join lift_passengers lp
    on l.id=lp.lift_id
    group by 1,2,3,4
    order by 1,2) as x
    where running_total