Complex
SQL Written Questions for Data Engineer
1. We
need to populate male and female alternatively
For Example:
Above records need to Populate as below:
Ans:
2. Find
all the students whose marks greater than the average marks in each subject within
a class
For Example:
Expected Output:
Output:
3. Find
the data given below, and display the data with cumulative values
CREATE TABLE MONTHLYVOLUME
(YEAR
NUMBER(4),
MONTH
CHAR(3),
SALES
NUMBER(3));
/
INSERT INTO MONTHLYVOLUME VALUES
(2007,'JAN',11);
INSERT INTO MONTHLYVOLUME VALUES
(2007,'FEB',9);
INSERT INTO MONTHLYVOLUME VALUES
(2007,'MAR',7);
INSERT INTO MONTHLYVOLUME VALUES
(2007,'APR',5);
INSERT INTO MONTHLYVOLUME VALUES
(2007,'MAY',14);
INSERT INTO MONTHLYVOLUME VALUES
(2007,'JUN',6);
INSERT INTO MONTHLYVOLUME VALUES
(2007,'JUL',8);
INSERT INTO MONTHLYVOLUME VALUES
(2007,'AUG',17);
INSERT INTO MONTHLYVOLUME VALUES
(2007,'SEP',18);
INSERT INTO MONTHLYVOLUME VALUES
(2007,'OCT',19);
INSERT INTO MONTHLYVOLUME VALUES
(2007,'NOV',12);
INSERT INTO MONTHLYVOLUME VALUES
(2007,'DEC',1);
INSERT INTO MONTHLYVOLUME VALUES
(2008,'JAN',4);
INSERT INTO MONTHLYVOLUME VALUES
(2008,'FEB',7);
INSERT INTO MONTHLYVOLUME VALUES
(2008,'MAR',8);
INSERT INTO MONTHLYVOLUME VALUES
(2008,'APR',21);
INSERT INTO MONTHLYVOLUME VALUES
(2008,'MAY',23);
INSERT INTO MONTHLYVOLUME VALUES
(2008,'JUN',24);
INSERT INTO MONTHLYVOLUME VALUES
(2008,'JUL',17);
INSERT INTO MONTHLYVOLUME VALUES
(2008,'AUG',18);
INSERT INTO MONTHLYVOLUME VALUES
(2008,'SEP',15);
INSERT INTO MONTHLYVOLUME VALUES
(2008,'OCT',13);
INSERT INTO MONTHLYVOLUME VALUES
(2008,'NOV',15);
INSERT INTO MONTHLYVOLUME VALUES
(2008,'DEC',16);
INSERT INTO MONTHLYVOLUME VALUES
(2009,'JAN',4);
INSERT INTO MONTHLYVOLUME VALUES
(2009,'FEB',5);
INSERT INTO MONTHLYVOLUME VALUES
(2009,'MAR',8);
INSERT INTO MONTHLYVOLUME VALUES
(2009,'APR',1);
INSERT INTO MONTHLYVOLUME VALUES
(2009,'MAY',3);
INSERT INTO MONTHLYVOLUME VALUES
(2009,'JUN',2);
INSERT INTO MONTHLYVOLUME VALUES
(2009,'JUL',7);
INSERT INTO MONTHLYVOLUME VALUES
(2009,'AUG',8);
INSERT INTO MONTHLYVOLUME VALUES
(2009,'SEP',5);
INSERT INTO MONTHLYVOLUME VALUES
(2009,'OCT',3);
INSERT INTO MONTHLYVOLUME VALUES
(2009,'NOV',1);
INSERT INTO MONTHLYVOLUME VALUES
(2009,'DEC',6);
INSERT INTO MONTHLYVOLUME VALUES
(2010,'JAN',4);
INSERT INTO MONTHLYVOLUME VALUES
(2010,'FEB',17);
INSERT INTO MONTHLYVOLUME VALUES
(2010,'MAR',8);
INSERT INTO MONTHLYVOLUME VALUES
(2010,'APR',2);
INSERT INTO MONTHLYVOLUME VALUES
(2010,'MAY',2);
INSERT INTO MONTHLYVOLUME VALUES
(2010,'JUN',4);
INSERT INTO MONTHLYVOLUME VALUES
(2010,'JUL',7);
INSERT INTO MONTHLYVOLUME VALUES
(2010,'AUG',8);
INSERT INTO MONTHLYVOLUME VALUES
(2010,'SEP',25);
INSERT INTO MONTHLYVOLUME VALUES
(2010,'OCT',13);
INSERT INTO MONTHLYVOLUME VALUES
(2010,'NOV',19);
INSERT INTO MONTHLYVOLUME VALUES
(2010,'DEC',18);
|
Expected Output:
Actual Output:
1. Find all
the students who enrol for all the courses in the particular year
For Example:
Expected Output:
Actual Output:
2. Find
out the top 3 highest sold products
For Example:
Expected Output:
Actual Output:
3. Based
on the call logs find out the customer whose first call and last call is same
person within a day
For Example:
Expected Output:
Actual Output:
4. Find
out all the sales representative who involves in sales of subsequent day as well
For Example:
Expected Output:
Actual Output:
Excellent!!
ReplyDelete