Рет қаралды 7,013
One of the SQL questions recently asked in TCS interview.
Given us products and transactions table, We need to Find product wise total amount, including products with no sales.
Let us create table and insert data
create table products (pid int, pname varchar(50), price int)
insert into products values (1, 'A', 1000),(2, 'B', 400),(3, 'C', 500);
create table transcations (pid int, sold_date DATE, qty int, amount int)
insert into transcations values (1, '2024-02-01', 2, 2000),(1, '2024-03-01', 4, 4000),
(1, '2024-03-15', 2, 2000),(3, '2024-04-24', 3, 1500),(3, '2024-05-16', 5, 2500);
For more SQL interview questions. Check out our playlist.
• SQL Interview Questions
Contact us:
info@cloudchallengers.com
Follow us on
Instagram : cloudchallengers
Facebook : cloudchallengers
LinkedIn : linkedin.com/company/cloudchallengers