C++ || STL || standard template libraries

Image
                                       C++ STL  1.      Pair :  Syntax :      pair <int,char> p1;     it creates a pair {2,'c'} like this.           pair <int,int> p2;     it creates a pair {2,3} like this .  Basic Code :  #include <bits/stdc++.h> using namespace std; int main() {     // cout<<"hello world\n";     pair <int,int> p1 = {1,2};     cout<<p1.first<< " "<< p1.second<<endl;          pair <int, pair<int ,char>> p2 = {1,{2,'c'}};     cout<<p2.first<<" "<<p2.second.first<<" "<<p2.second.second<<endl;          pair <int,int> arr[] = {{2,3},{4,5},{6,7}};     cout...

Sales Analysis III || Leetcode SQL solution || Easy approach || sub-query || 🔥🔥🔥🔥💯💯💯💯✅✅✅✅

 

                                        1084. Sales Analysis III

Leetcode question : 1084. Sales Analysis III

Write an SQL query that reports the products that were only sold in the first quarter of 2019. That is, between 2019-01-01 and 2019-03-31 inclusive.

Return the result table in any order.

The query result format is in the following example.



SQL SOLUTION :

select product_id,product_name 
from Product
where product_id not in 
(
    select p.product_id from Product p left join Sales s 
    on p.product_id=s.product_id 
    where s.sale_date <date('2019-01-01') 
    or
    s.sale_date >date('2019-03-31') 
    or
    s.seller_id is null 
);




Comments

Popular posts from this blog

1050. Actors and Directors Who Cooperated At Least Three Times || Leetcode sql solution || Simple and Easy Approach || ✅✅✅✅💯💯💯🔥🔥🔥🔥

Power of Millets || Happy And Healthy Life

Typing Lesson PART-3