In this video, you would learn how to write a SQL query to identify sellers who did not make any sales in 2020.
Script
Table 1 - orders
CREATE TABLE orders (
order_id INT PRIMARY KEY,
sale_date DATE,
order_cost DECIMAL(10, 2),
customer_id INT,
seller_id INT
);
INSERT INTO orders (order_id, sale_date, order_cost, customer_id, seller_id) VALUES
(1, '2020-03-01', 1500.00, 101, 1),
(2, '2020-05-25', 2400.00, 102, 2),
(3, '2019-05-25', 800.00, 101, 3),
(4, '2020-09-13', 1000.00, 103, 2),
(5, '2019-02-11', 700.00, 101, 2);
Table 2- sellers
CREATE TABLE sellers (
seller_id INT PRIMARY KEY,
seller_name VARCHAR(100)
);
INSERT INTO sellers (seller_id, seller_name) VALUES
(1, 'Daniel'),
(2, 'Ben'),
(3, 'Frank');
TIMESTAMP
00:00 Introduction
00:21 Problem Description
02:15 Solution Methods
03:30 Implementation
03:45 Method 1 Implementation (Using Sub-query)
06:23 Method 2 Implementation (Using LEFT Join)
#sql #dataanalysts #dataengineer #dataanalysis #interviewquestion #sqlinterview
On this page of the site you can watch the video online Target SQL Interview Question | Using Sub-query | Level - MEDIUM with a duration of hours minute second in good quality, which was uploaded by the user Nishtha Nagar 02 September 2024, share the link with friends and acquaintances, this video has already been watched 7,537 times on youtube and it was liked by 255 viewers. Enjoy your viewing!