Skip to main content

Posts

Showing posts with the label sql

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 MONTHLYVOLUM...

SQL Common Interview Questions

1 ) Write a Query To Delete The Repeted Rows from emp table; SQL>Delete from emp where rowid not in(select min(rowid)from emp group by ename)                 2) TO DISPLAY 5 TO 7 ROWS FROM A TABLE SQL>select ename from emp          where rowid in(select rowid from emp where rownum<=7          minus   select rowid from empi where rownum<5) 3)  DISPLAY  TOP N ROWS FROM TABLE? SQL>SELECT * FROM                 (SELECT *  FROM EMP ORDER BY ENAME DESC)                  WHERE ROWNUM <10; 4) DISPLAY   TOP 3 SALARIES FROM EMP; SQL>SELECT SAL FROM ( SELECT...