အားလုံးပဲ မင်္ဂလာပါ။ ဒီနေ့ Day 26 အတွက်ကတော့ Leetcode ရဲ့ difficulties Easy level problem တစ်ပုဒ်ဖြစ်တဲ့ 620. Not Boring Movies ဆိုတဲ့ problem ကို ရွေးချယ်ထားပါတယ်။
1Table: Cinema2 3+----------------+----------+4| Column Name | Type |5+----------------+----------+6| id | int |7| movie | varchar |8| description | varchar |9| rating | float |10+----------------+----------+11id is the primary key (column with unique values) for this table.12Each row contains information about the name of a movie, its genre, and its rating.13rating is a 2 decimal places float in the range [0, 10]ဒီပုစ္ဆာ မှာတော့ Cinema ဆိုတဲ့ table လေးကိုပေးထားပါတယ်။
1Example 1:2 3Input: 4Cinema table:5+----+------------+-------------+--------+6| id | movie | description | rating |7+----+------------+-------------+--------+8| 1 | War | great 3D | 8.9 |9| 2 | Science | fiction | 8.5 |10| 3 | irish | boring | 6.2 |11| 4 | Ice song | Fantacy | 8.6 |12| 5 | House card | Interesting | 9.1 |13+----+------------+-------------+--------+14Output: 15+----+------------+-------------+--------+16| id | movie | description | rating |17+----+------------+-------------+--------+18| 5 | House card | Interesting | 9.1 |19| 1 | War | great 3D | 8.9 |20+----+------------+-------------+--------+21Explanation: 22We have three movies with odd-numbered IDs: 1, 3, and 5. The movie with ID = 3 is boring so we do not include it in the answer.23 ကျွန်တော်တို့လုပ်ပေးဖို့လိုတာကတော့ id က မဂဏန်းဖြစ်ပြီး description က boring နဲ့မညီတဲ့ record တွေကို ရှာပေးရမှာပဲဖြစ်ပါတယ်။ Order ကိုလည်း rating နဲ့ DESC စီပေးရမှာပဲဖြစ်ပါတာ်။ ကျွန်တော်ကတော့ အောက်ကအတိုင်းလေး ရေးဖြစ်ခဲ့ပါတယ်ဗျာ။
1**SQL**2 3SELECT * FROM Cinema WHERE 4MOD(id, 2) != 0 AND description != 'boring' ORDER BY rating DESC;ပထမဆုံးအနေနဲ့ Id က မဂဏန်း ဖြစ်ရမယ်ဆိုတော့ MOD function လေးသုံးပြီး အကြွင်းရှာလိုက်ပါတယ်။ 2 နဲ့စား လို့ 0 နဲ့ မညီရဘူးဆိုပြီး မဂဏန်းဖြစ်အောင်စစ်ပေးလိုက်ပါတယ်။ Description ကိုလည်း boring နဲ့မညီရဘူးဆိုပြီးစစ်လိုက်ပြီးတော့ rating ကို DESC order စီပေးလိုက်ပါတယ်ဗျာ။
ဒါဆိုရင် လိုချင်တဲ့အဖြေလေးရရှိသွားပြီပဲဖြစ်ပါတယ်ဗျာ။ Video ကိုတော့အောက်က YouTube link လေးကနေတစ်ဆင့်ဝင်ကြည့်နိုင်ပါတယ်ဗျာ။ Stay safe and see you allပါဗျာ။
30 Days Of LeetCode Database Day 26 - 620. Not Boring Movies
Watch on YouTubeDiscussion
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

AWS - Application Load Balancer
Elastic Load Balancing (ELB) ELB ဆိုတာကတော့ request တွေကို တစ်နေရာတည်းမှ လက်ခံကာ Amazon EC2 instances၊ containers, etc.....

Terraform Day 3: Benefits of Terraform State
Terraform ကိုလေ့လာ တဲ့အခါ ကျွန််တော်တို့ရဲ့ Project Folder ထဲမှာ terraform.tfstate ဆိုတဲ့ ဖိုင်လေးကို တွေ့ဖူးကြပါလိမ့်မယ...

Terraform Day 2: Essential IaC Principles You Must Know
မနေ့ကတော့ Terraform အကြောင်း အကြမ်းဖျင်း Concept ကို ပြောပြခဲ့ပြီးပြီဆိုတော့ ဒီနေ့မှာတော့ Terraform ကို Professional ကျက...

TCP/IP Protocol
အားလုံးပဲမင်္ဂလာပါ။ ဒီနေ့ ကျွန်တော်တို့ TCP/IP Protocol အကြောင်း ဆွေးနွေးသွားပါမယ်။ ပထမဆုံးအနေနဲ့ TCP/IP ရဲ့ History လေး...

Terraform Day 1: Introduction to IAC and Terraform
ကျွန်တော်တို့ cloud အကြောင်း စပြောကြပြီဆိုရင် အရင်ဆုံး ခေါင်းထဲရောက်လာတာ Console ထဲဝင်၊ UI ကနေ ခလုတ်လေးတွေ လိုက်နှိပ်ပြီ...


