One of the SQL questions recently asked in BOSCH interview.
Given us brands table, we need to forward fill the categories wherever we have nulls for all brands in the table.
In order to solve this questions, we used ROW_NUMBER(), COUNT() and FIRST_VALUE() Functions. You will understand how all these functions works in this video.
Let us first create brands table
create table brands (category varchar(50), brand_name varchar(50))
Insert the records
insert into brands values ('chocolates', '5-star'),(NULL, 'dairy milk'),(NULL, 'perk'),(NULL, 'eclair'),('Biscuits', 'Britania'),(NULL, 'good day'),(NULL, 'boost')
Contact us:
info@cloudchallengers.com
Follow us on
Instagram : cloudchallengers
Facebook : cloudchallengers
LinkedIn : linkedin.com/company/cloudchallengers
28 апр 2024