You are on page 1of 7

--what is multitenancy?

A: creating multiple local databases in one database

--What are default values in a column?


A: NULL values

--If a number type column has data, then


can i decrease column size?
A:NO

--After truncate, can i restore data?


A: no

--After delete, can we see table structure?


A: YES

--How to delete table structure and data?


A: drop

--How to create a table structure from other table structure?


A: create table t2
as
select * from T1 where 1=2;

--What are the advantages of Oracle 12c?


A: -->communication is fast
-->changes are dynamic
-->more levels of security
-->Cost is reducing

--What is PDB? and why it is?


A: Pluggable database.
PDB is created for any one business application.

--What is the use of "&"?


A: It is known as Substitution Operator.
And it is used to submit a value at runtime.

--What is DUAL?
A: It is a system defined table.

--What is NULL value?


A: It is unknown value, we cant see it.

--How to restore a deleted table?


A: Flashback

--Can we apply ORDER BY clause on multiple columns?


A: YES

--How to get unique records from a table?


A: DISTINCT

--How to change column names in the output?


A: Select query with titles

--How to change column names in the table?


A: ALTER
--How to delete values from a column?
A: update

--What is the use of GRANT command?


A: To give the permissions

--How to restore deleted records?


A: ROLLBACK

--How can i search symbols or characters or digits?


A:Using LIKE operator

--What is the use of ESCAPE in LIKE operator?


A: To search for _ and % symbols

--How to filter table data?


A: By using WHERE clause

--Can i write multiple conditions in a single select query? How?


A: YES. By using Logical operators.

--What are constraints?


A: Business Rules/ Set of rules.

--What is Database consistency?


A: A database with only valid data according to business.

--How to validate data in the tables?


A: By defining constraints

--What is FOREIGN KEY?


A: It is constraint defined from PK

--How to define conditions on columns?


A: by using CHECK

--Can i define multiple PKs in single table?


A: No

--What is the basic purpose of PK?


A: To identify any record uniquely

--Consider there is no PK, then How can i identify a record uniquely?


A: by using ROWID

--How to get constraints information?


A: From user_constraints

--What is the default status of a constraint?


A: ENABLED

--Can i define a FK without a PK?


A: NO

--What is the use of ON DELETE CASCADE?


A: It allows the user to delete parent records,
then dependent child records are automatically deleted.

--How to add NOT NULL constraint?


A: By using ALTER command with MODIFY keyword.

--What is the use of NOVALIDATE?


A: we can enable any DEFERRABLE constraint

--What is the difference between normal constraint and deferrable constraint?


A: Normal constraint always verify old and new data
Deferrable constraint only verify new data.

--How to combine multiple table data?


A: SET OPERATORS

--What are the limitations of set operators?


A: --should select equal number of columns from each table.
--and selecting column data types should be similar in the same sequence.

--What are joins?


A: joins are useful to display data from multiple tables.

--On which basis , joins are selecting valid data?


A: Based on Join condition

--What is the difference between equi join , inner join and natural join?

--What is outer Join?


A: It will display all data from one table and only matched data from other table.

--What is TAB?
A: It is a table space.

--What is prerequisite to write a joinquery?


A: common column

--Consider 2 tables , with a common column. But no pk and no Fk. Then


--Are you able to write join query?
A: YES

--How to validate data in multiple tables?


OR
--How to implement data integrity?
A: By using Referential Integrity Constraint.

--What is the difference between equi join and outer join?


A: --Equi join display only matched data from both tables.
--Outer join display all data from one table and only
matched data from other table

--What is sub query?


A: A select query under where clause of other select query.

--What is a nested query?


A: Query with in other query

--What is a correlated sub query?


A: A sub query which depends on outer query

--What is the result of ALL operator?


A: If the outer query condition is satisfied with all values
given by sub query,then outer query display result.

--What is a view? and purpose of view?


A: View is a database object .
It is created based on frequently using data.
Views are created to implement data abstraction.
Views are useful to increase performance and security.

--How to create a view as read only view?


A: By using the option "with read only".

--How to perform restricted DML operations on the view?


A: By creating view with the clause " with check option".

--What is a temporary view?


A: Inline view

--What is Inline view?


A: Select query under from keyword of other select query.

--What is materialized view?


A: A view which has physical data.

--What are the refresh methods?


A: --FAST
--FORCE
--COMPLETE
--What are the types of FORCE refresh?
A: --on commit
--on demand

--How to delete materialized view?


A: drop materialized view <name>;

--Can i insert a record in to composite view?


A: NO

--What is USER_OBJECTS?
A: It contains all objects from current user account.

select object_name from user_objects;

--Can i alter sequence?


A: yes

--why are you creating sequences?


A: to generate sequential numbers automatically for any column.

--What are the pseudo columns with sequences?


A: CURR_VAL
NEXT_VAL

--IF i delete a table , then related sequence is deleted?


A: NO

--What is the use of Index?


A: To search the data as much as fast.

--What is bitmap index?


A: It is created on a column which has many number of duplicates.

--can i select data from index?


A: NO

--In the index, who is maintaining address of a record?


A: ROWID

--What is ROWID?
A: It is a pseudo column associated with table.

--How to display top n records from a table?


A: by using ROWNUM

--How to delete duplicate records from a table?


A: delete from <table>
where rowid not in(select Min(rowid) from <table>
group by col1,col2,.....);

--What is cluster?
A: It is physical storage area , which is shared by group of tables.

--On which basis , you are creating cluster?


A: common column.

--What is clustered index?


A: Index created on cluster key.

--How to create permenant alias names for the tables?


A: By using synonyms.

--What is the use of MERGE statement?


A: To syncronize one table data with data from table/view/query.

--Why are you using GROUP BY clause?


A: Based on grouping of data , if we want to perform aggregations.
Or
Based on distinct values of a column, if we want to perform aggregations.

--How to filter table data?


A: By using conditions with where clause.

--What is the use of HAVING clause?


A: To filter group by output.

--Can we apply aggregations on our data?


A: NO

--How to round up a value?


A: ROUND(), TRUNC()

--How to find out least or highest from given values?


A: greatest() or least()

--How to display last 10 characters from a string?


A: substr('str',-10)

--what is the use of INSTR()?


A: To find out the position of character either from begin or end of string.
--How to delete a character from given string?
A: replace()

--How to convert a date value in to oracle date?


A: TO_DATE()

--How to display dayname from given date?


A: TO_CHAR()

--How to convert a number value in to character?


A: TO_CHAR()

--How to find out number of years between 2 dates?


A: TRUNC(months_between(d1,d2)/12)

--What is the use of TRUNC along with date values?


A: date value is truncated to the begining of week,month,quarter or year

--Find the 2nd highest salary?


A: select max(sal) from <table>
where sal not in(select max(sal) from <table>);

--How to find nth highest salary?


A: dense_rank()

--What is the use of NVL()?


A: It will substitute given value, if the input value is null

--What is the use of DECODE ()?


A: we can write switch case logic

--> what is TAB?

--> What is Dual?

--> What is the use of DISTINCT clause?

--> What is the use of ORDER BY clause?

--> Can i apply order by clause on multiple columns? If yes,


what is expected result?

Yes. If first column under order by has duplicates,then


data is ordered based on second column under order by.

--> What is the difference between keyword and clause?

keyword is compulsary presented in the query.


clause is optional.

--> Who is E F CODD? And what are the rules?

12 rules.

You might also like