ACCENTURE INTERVIEW QUESTION | Return students whose salary is less than friend's salary

 DROP TABLE IF EXISTS Students

DROP TABLE IF EXISTS Packages

DROP TABLE IF EXISTS Friends



CREATE TABLE Students

(

ID INT,

[Name] varchar(100)

)


CREATE TABLE Packages

(

ID INT,

[Salary] decimal(18,2)

)



CREATE TABLE Friends

(

ID INT,

Friend_ID INT

)


INSERT INTO Students

VALUES

(1,'Ravi'),

(2,'Shyam'),

(3,'Jacob'),

(4,'Martin') 


INSERT INTO Friends

VALUES

(1,2),

(2,3),

(3,4),

(4,1)


INSERT INTO Packages

VALUES

(1,1500),

(2,1000),

(3,1100),

(4,1200)


Comments

Popular posts from this blog

50 Essential SQL Questions to Land Your Dream Job

How to find all the customers who placed orders on three consecutive days | SQL Scenario questions

ACCENTURE SQL INTERVIEW QUESTION | Change the ProductIDs