drop table Student_list;
create table Student_list(roll_no number, stu_name varchar2(30));
Insert into Student_list (ROLL_NO,stu_name) values (1,'KING');
Insert into Student_list (ROLL_NO,stu_name) values (2,'BLAKE');
Insert into Student_list (ROLL_NO,stu_name) values (3,'CLARK');
Insert into Student_list (ROLL_NO,stu_name) values (4,'JONES');
Insert into Student_list (ROLL_NO,stu_name) values (5,'SCOTT');
Insert into Student_list (ROLL_NO,stu_name) values (6,'RAGHU');
Insert into Student_list (ROLL_NO,stu_name) values (7,'FORD');
Insert into Student_list (ROLL_NO,stu_name) values (8,'SMITH');
Insert into Student_list (ROLL_NO,stu_name) values (9,'ALLEN');
Insert into Student_list (ROLL_NO,stu_name) values (10,'WARD');
Insert into Student_list (ROLL_NO,stu_name) values (1,'KING');
Insert into Student_list (ROLL_NO,stu_name) values (5,'SCOTT');
Insert into Student_list (ROLL_NO,stu_name) values (7,'FORD');
COMMIT;
select * from Student_list
order by roll_no,stu_name;
SELECT DISTINCT ROLL_NO,STU_NAME
FROM STUDENT_LIST
ORDER BY ROLL_NO,STU_NAME;
SELECT UNIQUE ROLL_NO,STU_NAME
FROM STUDENT_LIST
ORDER BY ROLL_NO,STU_NAME;
SELECT ROLL_NO,STU_NAME
FROM STUDENT_LIST
GROUP BY ROLL_NO,STU_NAME
ORDER BY ROLL_NO,STU_NAME;
SELECT ROLL_NO,STU_NAME
FROM STUDENT_LIST
UNION
SELECT ROLL_NO,STU_NAME
FROM STUDENT_LIST;
SELECT ROLL_NO,STU_NAME
FROM STUDENT_LIST
UNION
SELECT NULL,NULL
FROM DUAL WHERE 1=2;
SELECT ROLL_NO,STU_NAME
FROM STUDENT_LIST
INTERSECT
SELECT ROLL_NO,STU_NAME
FROM STUDENT_LIST;
SELECT ROLL_NO,STU_NAME
FROM STUDENT_LIST
MINUS
SELECT NULL,NULL
FROM DUAL;
SELECT ROLL_NO,STU_NAME FROM (
SELECT ROLL_NO,STU_NAME,
ROW_NUMBER() over(partition by ROLL_NO,STU_NAME
ORDER BY ROLL_NO,STU_NAME) R
FROM STUDENT_LIST)
where R=1;
SELECT ROLL_NO,STU_NAME FROM (
SELECT ROLL_NO,STU_NAME,
RANK() over(partition by ROLL_NO,STU_NAME
ORDER BY ROWNUM) R
FROM STUDENT_LIST)
where R=1;
SELECT * FROM STUDENT_LIST
WHERE ROWID IN (
SELECT MIN(ROWID)
FROM STUDENT_LIST
GROUP BY ROLL_NO,STU_NAME)
ORDER BY ROLL_NO,STU_NAME;
SELECt * FROM STUDENT_LIST A
WHERE 1 = ( SELECT COUNT(1)
FROM STUDENT_LIST B
WHERE A.ROLL_NO = B.ROLL_NO
AND A.STU_NAME = B.STU_NAME
AND A.ROWID >= B.ROWID);
create table Student_list(roll_no number, stu_name varchar2(30));
Insert into Student_list (ROLL_NO,stu_name) values (1,'KING');
Insert into Student_list (ROLL_NO,stu_name) values (2,'BLAKE');
Insert into Student_list (ROLL_NO,stu_name) values (3,'CLARK');
Insert into Student_list (ROLL_NO,stu_name) values (4,'JONES');
Insert into Student_list (ROLL_NO,stu_name) values (5,'SCOTT');
Insert into Student_list (ROLL_NO,stu_name) values (6,'RAGHU');
Insert into Student_list (ROLL_NO,stu_name) values (7,'FORD');
Insert into Student_list (ROLL_NO,stu_name) values (8,'SMITH');
Insert into Student_list (ROLL_NO,stu_name) values (9,'ALLEN');
Insert into Student_list (ROLL_NO,stu_name) values (10,'WARD');
Insert into Student_list (ROLL_NO,stu_name) values (1,'KING');
Insert into Student_list (ROLL_NO,stu_name) values (5,'SCOTT');
Insert into Student_list (ROLL_NO,stu_name) values (7,'FORD');
COMMIT;
select * from Student_list
order by roll_no,stu_name;
SELECT DISTINCT ROLL_NO,STU_NAME
FROM STUDENT_LIST
ORDER BY ROLL_NO,STU_NAME;
SELECT UNIQUE ROLL_NO,STU_NAME
FROM STUDENT_LIST
ORDER BY ROLL_NO,STU_NAME;
SELECT ROLL_NO,STU_NAME
FROM STUDENT_LIST
GROUP BY ROLL_NO,STU_NAME
ORDER BY ROLL_NO,STU_NAME;
SELECT ROLL_NO,STU_NAME
FROM STUDENT_LIST
UNION
SELECT ROLL_NO,STU_NAME
FROM STUDENT_LIST;
SELECT ROLL_NO,STU_NAME
FROM STUDENT_LIST
UNION
SELECT NULL,NULL
FROM DUAL WHERE 1=2;
SELECT ROLL_NO,STU_NAME
FROM STUDENT_LIST
INTERSECT
SELECT ROLL_NO,STU_NAME
FROM STUDENT_LIST;
SELECT ROLL_NO,STU_NAME
FROM STUDENT_LIST
MINUS
SELECT NULL,NULL
FROM DUAL;
SELECT ROLL_NO,STU_NAME FROM (
SELECT ROLL_NO,STU_NAME,
ROW_NUMBER() over(partition by ROLL_NO,STU_NAME
ORDER BY ROLL_NO,STU_NAME) R
FROM STUDENT_LIST)
where R=1;
SELECT ROLL_NO,STU_NAME FROM (
SELECT ROLL_NO,STU_NAME,
RANK() over(partition by ROLL_NO,STU_NAME
ORDER BY ROWNUM) R
FROM STUDENT_LIST)
where R=1;
SELECT * FROM STUDENT_LIST
WHERE ROWID IN (
SELECT MIN(ROWID)
FROM STUDENT_LIST
GROUP BY ROLL_NO,STU_NAME)
ORDER BY ROLL_NO,STU_NAME;
SELECt * FROM STUDENT_LIST A
WHERE 1 = ( SELECT COUNT(1)
FROM STUDENT_LIST B
WHERE A.ROLL_NO = B.ROLL_NO
AND A.STU_NAME = B.STU_NAME
AND A.ROWID >= B.ROWID);
Hello Siva,
ReplyDeleteMy name is satya, during this lockdown from past 2 days i am going thru videos in Youtube. I feel like i would have check your videos last year. Lack of deep knowledge in sql i have missed some of the opportunities in mnc companies.
your sessions are very informative.
i am working as a etl develoepr and parallely learning talend and Python by going thru some videos online.
just want to know what are the various skills i can add into my skillset along with my python to help in migrating into some other projects.
Thanks,
Satya
thank you for sharing this wonderfull article, here on my website we teach seo, digital marketing, affiliate marketing, earning money online, blogging etc.... if you will visit we provide a free cources of all this things.
ReplyDeleteThis comment has been removed by the author.
ReplyDelete