HP SQL INTERVIEW QUESTION | Customer Reference

Published: 19 October 2024
on channel: Data Sculptor
754
44

Join this channel to get access to perks:
   / @datasculptor2895  

Feedback: https://forms.gle/NQuCAy7p5a9wxW3LA

DROP TABLE IF EXISTS Customers;
DROP TABLE IF EXISTS Invoice;


-- Creating Customers table
CREATE TABLE Customers (
Id INT PRIMARY KEY,
Name VARCHAR(100) NOT NULL,
referredBy INT
);

-- Creating Invoice table
CREATE TABLE Invoice (
Id INT PRIMARY KEY,
BillingDate DATE NOT NULL,
CustomerID INT
);


-- Inserting data into Customers table
INSERT INTO Customers (Id, Name, referredBy)
VALUES
(1, 'John Doe', NULL), -- No referral
(2, 'Jane Smith', 1), -- Referred by John Doe
(3, 'Alice Johnson', 1), -- Referred by John Doe
(4, 'Bob Brown', 2), -- Referred by Jane Smith
(5, 'Charlie Davis', 3); -- Referred by Alice Johnson



-- Inserting data into Invoice table
INSERT INTO Invoice (Id, BillingDate, CustomerID)
VALUES
(1, '2024-09-01', 1), -- Invoice for John Doe
(2, '2024-09-03', 2), -- Invoice for Jane Smith
(3, '2024-09-05', 3), -- Invoice for Alice Johnson
(4, '2024-09-10', 4), -- Invoice for Bob Brown
(5, '2024-09-12', 5); -- Invoice for Charlie Davis

Playlists:
SQL Interview Questions:    • SQL Interview questions  
Recursive CTE:    • Recursive CTE  
PySpark Interview Questions:    • PySpark Interview Questions  
Power BI and DAX:    • Power BI and DAX  
Data Modeling:    • Data Modelling  
Generative AIs:    • Generative AIs  
Excel:    • Excel  
Cricket:    • Cricket  
SQL ADVANCED AGGREGATIONS:    • ADVANCED AGGREGATIONS SQL  



Follow me
Linkedin:   / data-sculptor-93a00b2a8  
Instagram:   / datasculptor2895  


On this page of the site you can watch the video online HP SQL INTERVIEW QUESTION | Customer Reference with a duration of hours minute second in good quality, which was uploaded by the user Data Sculptor 19 October 2024, share the link with friends and acquaintances, this video has already been watched 754 times on youtube and it was liked by 44 viewers. Enjoy your viewing!