Back to Browse

SQL Interview Questions and answers Part 48 | SQL LEET CODE Hard Problem

4.3K views
Mar 19, 2022
15:07

Do Like ๐Ÿ‘๐Ÿ‘, Comment & Subscribe SQL Interview Questions and answers : The Spending table keeps the logs of the spendings history of users that make purchases from an online shopping website which has a desktop and a mobile application. Write an SQL query to find the total number of users and the total amount spent using mobile only, desktop only and both mobile and desktop together for each date. ------------------------------------------------------------------------- ๐—๐—ผ๐—ถ๐—ป ๐—บ๐—ฒ ๐—ผ๐—ป ๐—ฆ๐—ผ๐—ฐ๐—ถ๐—ฎ๐—น ๐— ๐—ฒ๐—ฑ๐—ถ๐—ฎ:๐Ÿ”ฅ ------------------------------------------------------------------------- *Instagram : https://www.instagram.com/itjunction4all/ *Twitter: https://twitter.com/sunilkr5672 ------------------------------------------------------------------------- Table and Insert SQL Script : ------------------------------------------------------------------------- create table Spending ( User_id int, Spend_date date, Platform varchar(10), Amount int ); Insert into spending values(1,'2019-07-01','Mobile',100); Insert into spending values(1,'2019-07-01','Desktop',100); Insert into spending values(2,'2019-07-01','Mobile',100); Insert into spending values(2,'2019-07-02','Mobile',100); Insert into spending values(3,'2019-07-01','Desktop',100); Insert into spending values(3,'2019-07-02','Desktop',100); #SQL #LEETCODE #SQLInterviewQuestionsandanswers #sqlInterviewQuestions

Download

0 formats

No download links available.

SQL Interview Questions and answers Part 48 | SQL LEET CODE Hard Problem | NatokHD