HP SQL INTERVIEW QUESTION | Customer Reference

Publicado em: 19 Outubro 2024
no canal de: 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  


Nesta página do site você pode assistir ao vídeo on-line HP SQL INTERVIEW QUESTION | Customer Reference duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Data Sculptor 19 Outubro 2024, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 754 vezes e gostou 44 espectadores. Boa visualização!