SlideShare a Scribd company logo
1 of 6
SQL InterviewQuestions
SQL Interview Questions for Fresher’s and experienced whatever i have
faced in my Interviews, these sql interview questions are very helpful
for the people who are trying to get the job on Oracle SQL, PL/SQL.
Explain briefly NVL, NVL2, NULLIF functions
I have a table and created two indexes on two columns but i want
create 3rd index how you can create an index
What is data modelling and how to create relation between A and B
tables.
Difference between truncate and delete, why truncate faster rather
than delete.
Difference between view and materialized view
What is correlated subquery?
What is complex query and have you ever work on that.
Difference between btree and bitmap index
Difference between Translate and Decode.
Difference between Delete and Truncate.
Which is faster Case or Decode.
Difference between case and decode
What are pseudo columns in oracle
What is driving table?
As a developer how to tune sql query, explain the steps.
Can we create a primary key constraint on 2 columns and foreign key on
other column is it possible?
Create sequence sequence_name; , this sequence generate a sequence
value or not.
Write a query to find 4th highest salary (without analytical
function).
10 records in excel file, i wan to load 8 records only through sql *
loader, is it possible.
I have created a simple view but there is no base table, what happens.
I found bottlenecks in sql statement as below
Select * from emp where dept_no in (10,20);
Is it possible to change select * from emp where dept_no=10 or
dept_no=20; in production?
Can we create index on virtual columns.
What is invisible column?
How many types of partitions, explain interval partition, virtual
partitions and Reference Partition.
Can we update complex view, i want to insert, delete and update
operation on view, what are the steps of instead of dml operations.
What is the purpose of materialized view?
I have trying to create a sequence like 1 2 3 4 5 next row i want
start 1 2 3 4 5 is it possible?
I want to truncate a table before loading data through sql loader is
it right way?
What is reverse key index.
What is hash partition, when you create a hash partition?
When you create a function based index, why you go for function based
index,
What is hash join, explain how to use,
What is the difference between primary key and unique key,
I have create a composite primary key on two columns and inserting on
value and null value, is it possible, and create a unique index on
other columns, inserting 3 rows and inserting 3 null value on unique
column, is it possible.
Have you ever create sequence on primary key column
Tell me the query to retrieve top 5 salaries in each dept wise using
analytical function.
Types of materialized view refreshing methods
Fast refresh working on complex materialized view,can we create a
index on materialized view.
what is view and materialized view, types of refreshing methods.
have you ever worked on dynamic sql.
how to get top 10 salaries from two different tables
write a query to get more then 2 employees under manager
listagg
interset
which is the faster left outer join and right outer join
how to delete duplicate records
what is primary and unique constraint
in and exist which is the faster, why exist is faster?
Write a query to find 3rd highest salary
Using DENSE_RANK
SELECT *
FROM
( SELECT emp.*,DENSE_RANK() OVER(ORDER BY Sal DESC) Rno FROM EMP
)
WHERE Rno=3;
Using ROWNUM
----------------------------------------------------------------------
----
SELECT sal
FROM
(SELECT rownum rn,
sal
FROM
( SELECT DISTINCT sal FROM emp ORDER BY sal DESC
)
)
WHERE rn = 3;
----------------------------------------------------------------------
------------------
SELECT *
FROM emp
WHERE sal =
(SELECT sal
FROM
(SELECT rownum rn,
sal
FROM
( SELECT DISTINCT sal FROM emp ORDER BY sal DESC
)
)
WHERE rn = 3
);
Using SELF JOIN
SELECT *
FROM emp a
WHERE 3 =
(SELECT COUNT(DISTINCT(Sal)) FROM emp b WHERE a.sal<=b.sal
)
ORDER BY sal;
Write a query to find 10 highest salary
Can you write syntax of case statement?
Can we create a table on exiting table?
How to create a synonym, write syntax of synonym
What are partitions, when we go for partitions?
How to rebuild index, syntax of rebuild index
How to create a BLOB, syntax of blob
What is control file, syntax of control file?
What truncate and delete?
How to check the table or view exiting or not
Select * from a where hiredate+60 < sysdate; (here hiredate is non-
unique index, so query scanning index range or full table scanning.
Have you worked on explain plan, how to tune sql query
Can you write pivot query?
What are analytical functions?
Difference between sql *loader and external table, explain
requirements for that
Have you ever worked on partitions, explain Virtual column based
partitioning
what is nvl and nvl2 function and examples
Explain about TK-proof , syntax of TK-proof
Merge statement syntax
Partition Exchange(One table have 5 partitions like P1...P5, I want to
move P5 partition insert into another Table)?
Difference between 10g and 11g
COLN
---------
A
A
A
B
B
B
B
Write a query output like as
coln
------
3
4
coln
-----
A
B
C
D
E
I want output like this
TEXT
--------
A,B,C,D,E
EMPNO ENAME
----------- -----------
12345 REDDY
I want to count of empno and ename
coln
------
-1
-2
-3
-10
1
8
7
I want to count of positive and negative
select sum(decode(sign(value),1,value)) pos, sum(decode(sign(value),-
1,value)) neg from pn
select ( select sum(value) from pn where 0<value) as positive, (select
sum(value) from pn where 0>value) as negative from dual
select unique ( select sum(value) from pn where 0<value) as positive,
(select sum(value) from pn where 0>value) as negative from pn
Have you ever created tables, tell me 3 differences between primary
key and unique key.
Have you ever worked on partitions, why should we go to partitions?
Have you ever worked on indexes, what is the default index? Why we can
create a Function based index?
Have you created Materialized view, what is it?
What is the difference between view and materialized view?
Difference between import/export and sql loader
What is conventional path and direct path, which is the faster?
What is the requirement you have used import/export?
What are the functions you have worked on every day? What is the usage
of decode?
Have you ever worked on Analytical functions?
COLUMN_NO VALUE
----------------------------------------------
1 A
1 B
1 C
2 A
2 B
3 A
4 A
I want to show the output like as
COLUMN_NO VALUE
----------------------------------------------
1 A,B,C
2 A,B
3 A
4 A
What is your database version, what are 11g features,
How to find duplicate records on table, please find below table.
COL1 COL2
----------------------------------------
A 1
A 2
A 3
A 4
B 5
B 6
B 7
C 8
C 9
I want to show the output like as
A B C
-----------------------
4 3 2
SELECT A1.A,B1.B,C1.C FROM (SELECT COUNT(NAME)A FROM Ta WHERE Name
='A')A1,
(SELECT COUNT(NAME)B FROM Ta WHERE Name='B')B1,
(SELECT COUNT(Name)C FROM Ta WHERE Name='C')C1
select decode(col1,'A',count(1)) "A",decode(col1,'B',count(1))
"B",decode(col1,'C',count(1)) "C" from table1
Group by col1
Select * from( select col1,col2 from table_name ) pivot( count(col2)
for col1 in ('A','B','C') );
select count(decode(col1,'A',col2)) A,count(decode(col1,'B',col2))
B,count(decode
(col1,'C',col2)) C from r6;
I have a csv file in outside database, every 10 minutes added new
records in csv file. My requirement is load csv file in database,
which method you to approach to load csv file to database.
If you created primary key which index created and if you created
index which constraint created automatically?
What is nvl and nvl2?
Can you write syntax of decode
Count(*) status
-------------------------
1 s
1 s
1 s
2 a
2 a
3 c
Can you write a query for this output?
Difference between primary and unique and i am retrieving unique
column, that time unique column firing or not?
Difference between nvl and nvl2

More Related Content

What's hot

Sql Injection Adv Owasp
Sql Injection Adv OwaspSql Injection Adv Owasp
Sql Injection Adv Owasp
Aung Khant
 

What's hot (17)

SQL injection exploitation internals
SQL injection exploitation internalsSQL injection exploitation internals
SQL injection exploitation internals
 
Intro to T-SQL – 2nd session
Intro to T-SQL – 2nd sessionIntro to T-SQL – 2nd session
Intro to T-SQL – 2nd session
 
Sql tutorial-Structured query language
Sql tutorial-Structured query languageSql tutorial-Structured query language
Sql tutorial-Structured query language
 
Intro to T-SQL - 1st session
Intro to T-SQL - 1st sessionIntro to T-SQL - 1st session
Intro to T-SQL - 1st session
 
Introduction to SQL, SQL*Plus
Introduction to SQL, SQL*PlusIntroduction to SQL, SQL*Plus
Introduction to SQL, SQL*Plus
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
SQL
SQLSQL
SQL
 
Sql Injection Adv Owasp
Sql Injection Adv OwaspSql Injection Adv Owasp
Sql Injection Adv Owasp
 
Pl sql-ch1
Pl sql-ch1Pl sql-ch1
Pl sql-ch1
 
SQL Injection
SQL Injection SQL Injection
SQL Injection
 
Sql injection
Sql injectionSql injection
Sql injection
 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
 
SQL2SPARQL
SQL2SPARQLSQL2SPARQL
SQL2SPARQL
 
treeview
treeviewtreeview
treeview
 
Advanced sql injection 2
Advanced sql injection 2Advanced sql injection 2
Advanced sql injection 2
 
New T-SQL Features in SQL Server 2012
New T-SQL Features in SQL Server 2012 New T-SQL Features in SQL Server 2012
New T-SQL Features in SQL Server 2012
 
Schema webinar
Schema webinarSchema webinar
Schema webinar
 

Viewers also liked

Sql queries with answers
Sql queries with answersSql queries with answers
Sql queries with answers
vijaybusu
 

Viewers also liked (12)

Sql interview question part 9
Sql interview question part 9Sql interview question part 9
Sql interview question part 9
 
Sql interview question part 8
Sql interview question part 8Sql interview question part 8
Sql interview question part 8
 
Oracle SQL Interview Questions for Freshers
Oracle SQL Interview Questions for FreshersOracle SQL Interview Questions for Freshers
Oracle SQL Interview Questions for Freshers
 
SQL practice questions set - 2
SQL practice questions set - 2SQL practice questions set - 2
SQL practice questions set - 2
 
Sql queries questions and answers
Sql queries questions and answersSql queries questions and answers
Sql queries questions and answers
 
My Experience Using Oracle SQL Plan Baselines 11g/12c
My Experience Using Oracle SQL Plan Baselines 11g/12cMy Experience Using Oracle SQL Plan Baselines 11g/12c
My Experience Using Oracle SQL Plan Baselines 11g/12c
 
Sql interview questions and answers
Sql interview questions and  answersSql interview questions and  answers
Sql interview questions and answers
 
Oracle Complete Interview Questions
Oracle Complete Interview QuestionsOracle Complete Interview Questions
Oracle Complete Interview Questions
 
Sql queires
Sql queiresSql queires
Sql queires
 
Top 100 SQL Interview Questions and Answers
Top 100 SQL Interview Questions and AnswersTop 100 SQL Interview Questions and Answers
Top 100 SQL Interview Questions and Answers
 
Sql ppt
Sql pptSql ppt
Sql ppt
 
Sql queries with answers
Sql queries with answersSql queries with answers
Sql queries with answers
 

Similar to Sql interview questions

Analytic & Windowing functions in oracle
Analytic & Windowing functions in oracleAnalytic & Windowing functions in oracle
Analytic & Windowing functions in oracle
Logan Palanisamy
 

Similar to Sql interview questions (20)

Oracle Join Methods and 12c Adaptive Plans
Oracle Join Methods and 12c Adaptive PlansOracle Join Methods and 12c Adaptive Plans
Oracle Join Methods and 12c Adaptive Plans
 
SQLQueries
SQLQueriesSQLQueries
SQLQueries
 
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
 
How to leave the ORM at home and write SQL
How to leave the ORM at home and write SQLHow to leave the ORM at home and write SQL
How to leave the ORM at home and write SQL
 
Table functions - Planboard Symposium 2013
Table functions - Planboard Symposium 2013Table functions - Planboard Symposium 2013
Table functions - Planboard Symposium 2013
 
Analytic & Windowing functions in oracle
Analytic & Windowing functions in oracleAnalytic & Windowing functions in oracle
Analytic & Windowing functions in oracle
 
Sql
SqlSql
Sql
 
SQL
SQLSQL
SQL
 
Oracle sql tutorial
Oracle sql tutorialOracle sql tutorial
Oracle sql tutorial
 
12c SQL Plan Directives
12c SQL Plan Directives12c SQL Plan Directives
12c SQL Plan Directives
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Data Definition Language (DDL)
Data Definition Language (DDL) Data Definition Language (DDL)
Data Definition Language (DDL)
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
 
Top 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsTop 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tips
 
Oracle NOLOGGING
Oracle NOLOGGINGOracle NOLOGGING
Oracle NOLOGGING
 
The ultimate-guide-to-sql
The ultimate-guide-to-sqlThe ultimate-guide-to-sql
The ultimate-guide-to-sql
 
Select To Order By
Select  To  Order BySelect  To  Order By
Select To Order By
 
SQL Database Performance Tuning for Developers
SQL Database Performance Tuning for DevelopersSQL Database Performance Tuning for Developers
SQL Database Performance Tuning for Developers
 
Unit 3
Unit 3Unit 3
Unit 3
 

Recently uploaded

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 

Recently uploaded (20)

WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 

Sql interview questions

  • 1. SQL InterviewQuestions SQL Interview Questions for Fresher’s and experienced whatever i have faced in my Interviews, these sql interview questions are very helpful for the people who are trying to get the job on Oracle SQL, PL/SQL. Explain briefly NVL, NVL2, NULLIF functions I have a table and created two indexes on two columns but i want create 3rd index how you can create an index What is data modelling and how to create relation between A and B tables. Difference between truncate and delete, why truncate faster rather than delete. Difference between view and materialized view What is correlated subquery? What is complex query and have you ever work on that. Difference between btree and bitmap index Difference between Translate and Decode. Difference between Delete and Truncate. Which is faster Case or Decode. Difference between case and decode What are pseudo columns in oracle What is driving table? As a developer how to tune sql query, explain the steps. Can we create a primary key constraint on 2 columns and foreign key on other column is it possible? Create sequence sequence_name; , this sequence generate a sequence value or not. Write a query to find 4th highest salary (without analytical function). 10 records in excel file, i wan to load 8 records only through sql * loader, is it possible. I have created a simple view but there is no base table, what happens. I found bottlenecks in sql statement as below Select * from emp where dept_no in (10,20); Is it possible to change select * from emp where dept_no=10 or dept_no=20; in production? Can we create index on virtual columns. What is invisible column? How many types of partitions, explain interval partition, virtual partitions and Reference Partition. Can we update complex view, i want to insert, delete and update operation on view, what are the steps of instead of dml operations. What is the purpose of materialized view? I have trying to create a sequence like 1 2 3 4 5 next row i want start 1 2 3 4 5 is it possible? I want to truncate a table before loading data through sql loader is it right way? What is reverse key index. What is hash partition, when you create a hash partition?
  • 2. When you create a function based index, why you go for function based index, What is hash join, explain how to use, What is the difference between primary key and unique key, I have create a composite primary key on two columns and inserting on value and null value, is it possible, and create a unique index on other columns, inserting 3 rows and inserting 3 null value on unique column, is it possible. Have you ever create sequence on primary key column Tell me the query to retrieve top 5 salaries in each dept wise using analytical function. Types of materialized view refreshing methods Fast refresh working on complex materialized view,can we create a index on materialized view. what is view and materialized view, types of refreshing methods. have you ever worked on dynamic sql. how to get top 10 salaries from two different tables write a query to get more then 2 employees under manager listagg interset which is the faster left outer join and right outer join how to delete duplicate records what is primary and unique constraint in and exist which is the faster, why exist is faster? Write a query to find 3rd highest salary Using DENSE_RANK SELECT * FROM ( SELECT emp.*,DENSE_RANK() OVER(ORDER BY Sal DESC) Rno FROM EMP ) WHERE Rno=3; Using ROWNUM ---------------------------------------------------------------------- ---- SELECT sal FROM (SELECT rownum rn, sal FROM ( SELECT DISTINCT sal FROM emp ORDER BY sal DESC ) ) WHERE rn = 3; ---------------------------------------------------------------------- ------------------ SELECT * FROM emp WHERE sal = (SELECT sal
  • 3. FROM (SELECT rownum rn, sal FROM ( SELECT DISTINCT sal FROM emp ORDER BY sal DESC ) ) WHERE rn = 3 ); Using SELF JOIN SELECT * FROM emp a WHERE 3 = (SELECT COUNT(DISTINCT(Sal)) FROM emp b WHERE a.sal<=b.sal ) ORDER BY sal; Write a query to find 10 highest salary Can you write syntax of case statement? Can we create a table on exiting table? How to create a synonym, write syntax of synonym What are partitions, when we go for partitions? How to rebuild index, syntax of rebuild index How to create a BLOB, syntax of blob What is control file, syntax of control file? What truncate and delete? How to check the table or view exiting or not Select * from a where hiredate+60 < sysdate; (here hiredate is non- unique index, so query scanning index range or full table scanning. Have you worked on explain plan, how to tune sql query Can you write pivot query? What are analytical functions? Difference between sql *loader and external table, explain requirements for that Have you ever worked on partitions, explain Virtual column based partitioning what is nvl and nvl2 function and examples Explain about TK-proof , syntax of TK-proof Merge statement syntax Partition Exchange(One table have 5 partitions like P1...P5, I want to move P5 partition insert into another Table)? Difference between 10g and 11g COLN --------- A A A B B B B Write a query output like as
  • 4. coln ------ 3 4 coln ----- A B C D E I want output like this TEXT -------- A,B,C,D,E EMPNO ENAME ----------- ----------- 12345 REDDY I want to count of empno and ename coln ------ -1 -2 -3 -10 1 8 7 I want to count of positive and negative select sum(decode(sign(value),1,value)) pos, sum(decode(sign(value),- 1,value)) neg from pn select ( select sum(value) from pn where 0<value) as positive, (select sum(value) from pn where 0>value) as negative from dual select unique ( select sum(value) from pn where 0<value) as positive, (select sum(value) from pn where 0>value) as negative from pn Have you ever created tables, tell me 3 differences between primary key and unique key. Have you ever worked on partitions, why should we go to partitions? Have you ever worked on indexes, what is the default index? Why we can create a Function based index? Have you created Materialized view, what is it? What is the difference between view and materialized view? Difference between import/export and sql loader What is conventional path and direct path, which is the faster? What is the requirement you have used import/export? What are the functions you have worked on every day? What is the usage of decode? Have you ever worked on Analytical functions? COLUMN_NO VALUE ---------------------------------------------- 1 A 1 B
  • 5. 1 C 2 A 2 B 3 A 4 A I want to show the output like as COLUMN_NO VALUE ---------------------------------------------- 1 A,B,C 2 A,B 3 A 4 A What is your database version, what are 11g features, How to find duplicate records on table, please find below table. COL1 COL2 ---------------------------------------- A 1 A 2 A 3 A 4 B 5 B 6 B 7 C 8 C 9 I want to show the output like as A B C ----------------------- 4 3 2 SELECT A1.A,B1.B,C1.C FROM (SELECT COUNT(NAME)A FROM Ta WHERE Name ='A')A1, (SELECT COUNT(NAME)B FROM Ta WHERE Name='B')B1, (SELECT COUNT(Name)C FROM Ta WHERE Name='C')C1 select decode(col1,'A',count(1)) "A",decode(col1,'B',count(1)) "B",decode(col1,'C',count(1)) "C" from table1 Group by col1 Select * from( select col1,col2 from table_name ) pivot( count(col2) for col1 in ('A','B','C') ); select count(decode(col1,'A',col2)) A,count(decode(col1,'B',col2)) B,count(decode (col1,'C',col2)) C from r6;
  • 6. I have a csv file in outside database, every 10 minutes added new records in csv file. My requirement is load csv file in database, which method you to approach to load csv file to database. If you created primary key which index created and if you created index which constraint created automatically? What is nvl and nvl2? Can you write syntax of decode Count(*) status ------------------------- 1 s 1 s 1 s 2 a 2 a 3 c Can you write a query for this output? Difference between primary and unique and i am retrieving unique column, that time unique column firing or not? Difference between nvl and nvl2