Posts

Showing posts from April, 2023

Power of Millets || Happy And Healthy Life

Image
Foundation Day Meeting : By   D. Anjaneyulu Reddy : Power of millets: When food is right no medicine is needed. When food is wrong no medicine works 1. Cosmetologist : due to unbalanced diet, regularly going to cosmetologist 2. Harmonal imbalance : hair loss 3. 1 gm of sugar / 1 litre of blood : It is good for health. 4. Staple food : It is eaten regularly , large part of person's diet. 5. Don't eat icecream as it increase the sugar content in blood. Embrace meaning : include , hug

Percentage of users attending the contest || Leetcode solution || simple explanation ||πŸ’―πŸ’―πŸ’―πŸ’―βœ…βœ…βœ…πŸ”₯πŸ”₯πŸ”₯πŸ”₯

                                1633 .   Percentage of Users Attended a Contest Problem:- To find the percentage of users attending contest from users and register table  Link for question :-  click here so we need to use group by contest_id then aggregation is performed on count(register.user_id) Approach select count ( * ) from users This will get the total count of the table in users is 3. count ( register . user_id ) At first group by is done on contest_id (multiple rows to single row) and aggregation is done on count(register.user_id) SQL Solution :-  # Write your MySQL query statement below select register . contest_id , round ( count ( register . user_id ) * 100 / ( select count ( * ) from users ) , 2 ) as percentage from users inner join register on users . user_id = register . user_id group by contest_id order by percentage desc , contest...

Bank account summary II || Leetcode SQL query || Fully-Explained || πŸ’―πŸ’―πŸ’―βœ…βœ…βœ…πŸ”₯πŸ”₯πŸ”₯

Image
                           1587 .   Bank Account Summary II πŸ‘‡πŸ‘‡πŸ‘‡ Write an SQL query to report the name and balance of users with a balance higher than  10000 . The balance of an account is equal to the sum of the amounts of all transactions involving that account. Return the result table in  any order . The query result format is in the following example. Explanation: Alice's balance is (7000 + 7000 - 3000) = 11000. Bob's balance is 1000. Charlie's balance is (6000 + 6000 - 4000) = 8000. SQL Solution :- # Write your MySQL query statement below # select * select name , sum ( amount ) as balance from users inner join transactions on users . account = transactions . account group by name having balance > 10000 ; Full-Explanation :-  Appoach:    We need to find the name and balance of the tables.  balance is sum of amount Query: firstly, sel...