ক্যাটাগরি মেনু রিডিজাইনের জন্য দরকার প্রতিটি শীর্ষ (root, parent_id NULL) ক্যাটাগরির নিচে মোট কতটা প্রোডাক্ট জমা আছে — নিজের নামে, সরাসরি সন্তানে আর নাতি-ক্যাটাগরিতে বসা প্রোডাক্ট মিলিয়ে। প্রতি শীর্ষ ক্যাটাগরির category (নাম) ও products (সেই পুরো গাছের প্রোডাক্ট সংখ্যা) বের করো; বেশি প্রোডাক্ট আগে, সমান হলে নাম অনুযায়ী।
কোনো ইনপুট নেই — একটি SQL query লেখো।
প্রতি লাইনে category, products — সংখ্যা নিচের ক্রমে, টাই-এ category।
Write your solution, test it against custom input, then submit for a real verdict.
Your submissions, verdicts, drafts and contest score are tied to your account. Registration is free.
ShopSphere fixture. Standard SQL (SQLite-compatible engine).
SQL samples run against the ShopSphere fixture. When a sample shows dataset setup, the judge applies it before running your query; the expected rows are TSV.
Base ShopSphere fixture (no changes)
Electronics 6 Books 3 Fashion 3 Home 2
insert into categories (id,name,parent_id) values (9,'Kitchen',8); insert into products (id,vendor_id,category_id,name,price_cents,stock,rating) values (15,5,9,'Steel Pot',140000,9,4.3);
Electronics 6 Books 3 Fashion 3 Home 3