HP SQL INTERVIEW QUESTION | Customer Reference

Publié le: 19 octobre 2024
sur la chaîne: 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  


Sur cette page du site, vous pouvez voir la vidéo en ligne HP SQL INTERVIEW QUESTION | Customer Reference durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Data Sculptor 19 octobre 2024, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 754 fois et il a aimé 44 téléspectateurs. Bon visionnage!