အားလုံးပဲ မင်္ဂလာပါ။ ဒီနေ့ Day 20 အတွက်ကတော့ Leetcode ရဲ့ difficulties Easy level problem တစ်ပုဒ်ဖြစ်တဲ့ 586. Customer Placing the Largest Number of Orders ဆိုတဲ့ problem ကို ရွေးချယ်ထားပါတယ်။ ဒီပုစ္ဆာ မှာတော့ Orders table လေးပေးထားပြီးတော့ order_number , customer_numberColumn တွေပါဝင်ပါတယ်။
1Example 1:2 3Input: 4Orders table:5+--------------+-----------------+6| order_number | customer_number |7+--------------+-----------------+8| 1 | 1 |9| 2 | 2 |10| 3 | 3 |11| 4 | 3 |12+--------------+-----------------+13Output: 14+-----------------+15| customer_number |16+-----------------+17| 3 |18+-----------------+19Explanation: 20The customer with number 3 has two orders, which is greater than either customer 1 or 2 because each of them only has one order. 21So the result is customer_number 3.22 ကျွန်တော်တို့လုပ်ပေးရမှာက order record အများဆုံးရှိတဲ့ customer ကိုရှာပေးရမှာပဲဖြစ်ပါတယ်။
ကျွန်တော်က တော့ အောက်ကအတိုင်းလေး ရေးဖြစ်ခဲ့ပါတယ်။
1**SQL**2 3SELECT customer_number FROM Orders 4GROUP BY customer_number5ORDER BY COUNT(order_number) DESC 6LIMIT 1;ပထဆုံးအနေနဲ့ ကျွန်တော်တို့က customer တစ်ယောက်ချင်းစီရဲ့ record တွေကို စုစည်းချင်တော့ customer number နဲ့ Group By လုပ်လိုက်ပါတယ်။ ပြီးရင်တော့ ရရှိလာတဲ့ record တွေကို COUNT function သုံးပြီး DESC စီပေးလိုက်ပါတယ်။ ဒါဆို record အများဆုံး customer မှာက အပေါ်ဆုံးရောက်နေပြီပဲဖြစ်ပါတယ်။ ကျွန်တော်တို့ကတစ်ယောက်ပဲရှာပေးဖို့လို တော့ LIMIT 1 ပေးပြီး တစ်ယောက်ထဲဖြစ်အောင်လုပ်လိုက်ပါတယ်။ ဒါဆိုရင်တော့ ကျွန်တော်တို့လိုချင်တဲ့ order အများဆုံးရှိတဲ့ customer ရရှိလာပြီပဲဖြစ်ပါတယ်ဗျာ။ Video ကိုတော့အောက်က YouTube link လေးကနေတစ်ဆင့်ဝင်ကြည့်နိုင်ပါတယ်ဗျာ။ Stay safe and see you allပါဗျာ။ 30 Days Of LeetCode Database Day 20 - 586. Customer Placing the Largest Number of Orders
Discussion
Join the conversation
How do you feel about this article?
Comments
Sign in to join the conversation
Sign in to be the first to comment!
Share Your Article
Share with your professional network
Recent Articles

Day 2 - GitHub Actions ရဲ့ အဓိက Concepts များနှင့် Runner အကြောင်း
ပြီးခဲ့တဲ့အပတ် Day 1 တုန်းက ကျွန်တော်တို့ CI/CD ရဲ့ Concept တွေကို အကြမ်းဖျင်း ပြောခဲ့ကြပြီးပြီနော်။ ဒီနေရာမှာ လက်တွေ့မစ...
Day 1 - Software Development ကို ပိုပြီးမြန်စေမယ့် CI/CD
Software တစ်ခုရေးပြီးပြီဆိုရင် "ငါ့စက်ထဲမှာတော့ အလုပ်လုပ်တယ်" ဆိုရုံနဲ့ မပြီးသေးပါဘူး။ User တွေသုံးမယ့် Server ပေါ်ရောက်...

Secure AWS ECR Github Action Using OIDC
Modern DevOps နှင့် Cloud Security တို့မှာ အဓိကဖြစ်လာသည့် Authentication System ယနေ့ခေတ် DevOps, Cloud Engineering, CI/C...

Manual vs Automated Infrastructure: Why "useradd" Still Matters in the Terraform Era
DevOps careerကို လျှောက်နေတဲ့သူတိုင်း Terraform၊ Ansible စတဲ့ Infrastructure as Code (IaC) tools တွေရဲ့ အလုပ်လုပ်နိုင်စွ...
From Surviving to Thriving
“AI ကြောင့် developer အလုပ်ပျောက်သွားမလား?” ဆိုတဲ့ မေးခွန်းကို Junior developer တိုင်း စဉ်းစားဖူးကြမှာပါ။ ဈေးကွက်အခြေအနေ...

