Monday, 22 April 2013

ORACLE INTERVIEW QUESTIONS =>PART3



  1. What is data?
Data is a collection of raw, facts and figures that is use in different place we can store anything in database is called data.
  1. What is database?
Collection of organized data which can easily managed access, understand, and update.
  1. What is database management system?
Any programming environment used to create containers, to manage human data, can be conceptualized as a Data Management System
  1. What is table?
It is a set of elements that is consist of rows and columns in which we can store our data. In any table we define specified no, of columns and there are many no. of rows are available in table that is use for store the data row wise.
  1. What is column?
Column is a one element of table that is use logically vertical shape in table. We define specified no. of columns in one table then store data in it.
  1. What is row?
Rows are also second element of table that is use for store the data in table as a horizontally shape. We can enter many rows in one table. In database terms we can say one record to one row in table.
  1. What is primary key?
A primary is uniquely identifies a row of the table this key ensure two things one is that null value does not allow and duplicate value also not allowed in table. A table must always have one and only one primary key. Primary key value is normally employee code, Driving license code, NIC code etc.
  1. What is foreign key?
A foreign key is a references or a link between one table and another. The foreign key can be used to cross reference tables. A foreign has a link with parent table (that have primary key value). Suppose we have one table with primary key and w have second table that have foreign key and have a relation with parent table than we must enter the values in second table that is totally related with parent table.
  1. What is unique key?
Unique key does not accept duplicate values but accept null values in oracle. Unique key is very much related with primary key in primary key we cannot enter NULL value and also duplicate value. But on the other hand in unique key we can enter NULL value but not duplicate value. For example in employee database we set Driving license no. unique because one employee have unique license no. and some employees have not.
  1. What is the difference between primary key and unique key?
Unique key does not accept duplicate values but accept null values and primary key does not accept both two either NULL  or duplicate data.
  1. What is Null constraint?
The columns that have NULL constraint must fill with some data. A column in a table can be specified not null. It’s not possible to insert a null in such a column we cannot leave any column empty in tables that have NULL constraint. It should be fill with no matter with duplication of that.
  1. What is the maximum no. of column in oracle table?
The maximum no. of columns is 255.
  1. Is COMMIT statement can be use in database trigger?
We cannot use any transaction control statement (like commit, rollback, savepoint etc.) into the body of a trigger. But oracle provides a facility called Autonomous Transactions through which you can achieve this. You add that piece of the code, which contains commit, in some block and make that block as Autonomous Transaction and call or use that block into your trigger.

What is SQL statement?
SQL stands for Structured Query Language that is use for updating, deleting and inserting the  information from databases. SQL is an ANSI and ISO standard and is the de-facto standard database query language. Oracle database also support this language.
What are database triggers and how many types of triggers?
Database triggers are a set of code that run or fire automatically when the specific operation will performed like Insert, Update and Delete. They are store procedures that are auto configure and fire when certain events take place in database.
There are two types of triggers
1-      Tables level trigger
2-      Row level trigger
Table level trigger are fire at one time but row level trigger fire on every row or on any transaction in the table.
What are the means of values of: new and: old in the trigger?
These two: new and: old are use in database triggers. These are basically use for referencing the trigger value by using triggers. For example we want to update anything in table and this table have database trigger on After Update then we use these two keywords for updating the values again this table.
 What is the Mutating in the trigger?
The mutating will occur when in Oracle when the table that originally fired the triggering event is being accessed in the body of the trigger code, directly or implicitly in a procedure, or in a nested trigger called from the trigger body. This is because the table is in middle of a transaction, and referencing the same table again in the middle of the updating action causes the trigger to mutate.
 Can we write a trigger for view?
Yes we can write a trigger on view by using key word “instead of” but did not use Before or After option on trigger.
 Can we create a view on another view?
Yes we can create a view on another view.
What are the advantages of view?
1-      Restrict the data and column s of the base tables.
2-      Use complex quires easy and show the data of complex quires.
3-      Make different views according to requirement on many on table.
4-      We can hide business rules by using view.
What are function and how many types of functions?
Functions or user defined function are set of SQL/PLSQL code that are store in database and return the value. In function some data is manipulating by using some statement then return a specific value.
What is the difference between row level and Table level triggers?
Table level trigger are fire at one time but row level trigger fire on every row or on any transaction in the table.
What is the difference between Database triggers and Form level triggers?
Database trigger are written in database directly and fire on behalf of any transaction like Insert, Update and delete on table automatically. On the other hand we form level trigger are use in forms and fire on any level like item level, row level or on block level on requirement of application. Main difference in database trigger and form level triggers is that database trigger fire automatically and form level trigger fire on user or application requirement.
 What is the advantage of stored procedure over the database triggers?
Store procedure are compile one time and stay in database and wait for calling but on the other hand database trigger fire every time when we have to perfume any change in database.
 What are cascading of triggers?
Cascading of trigger means if we insert data in one table and that table have trigger on it then trigger fire. And in this trigger there is another table that we are using for insert the data in it and this table has also trigger on it then this trigger also fire. This is called cascading of triggers.
 What is Pseudo column?
Pseudo columns are database columns that are using for different purposes in oracle database like ROWNUM, ROWID, SYSDATE, UID, USER, ORA_ROWSCN, SYSTIMESTAMP,
 What is Dual and where it can be use?
Dual is a database table owner is sys and reside in data dictionary. It have only one column name DUMMY and one data X. It is normally use for select the values of Pseudo columns.
 Can we insert, update, delete, alter and drop DUAL table?
Yes we can Insert, update, delete alter and also drop Dual table in oracle.
 If we create a table with name DUAL it can be work same as DUAL?
Yes we create table with same name of DUAL and also it will work like same of dual table.
What are group functions and how many types of group function?
Group functions return the single result on based on many rows. Like count, sum, min, max, avg first, last these functions return one row result based on many rows.


What are cursors and how many types of cursors?
Cursor is a pointer variable in a memory and use for DML operations. Cursor basically is a private SQL memory area it is also use to improve the performance of the database.
There are two types of cursors.
1- Implicit cursor
2- Explicit cursor
Implicit cursor use oracles to manipulate the DML opperations and programmer have no control on this type of cursor. We use sql%notfound and sql%rowcount in implicit cursor. Explicit cursors are created by the programmer and programmer can control it by using these keywords Fetch, Open and close.
 Define Oracle cursor attributes.
There are five types of cursors attributes
1- %isopen      (Verify whether this cursor is open or not)
2- %found       (If cursor fetch the data then %found return true)
3- %notfound (If cursor fetches not data then %notfound return true)
4- %rowcount (It return no. of rows that are in cursor and also give position of record)
5- %bulk_rowcount (%bulk_rowcount is same like %rowcount but it is used in bulk)
How can we pass variable in cursors?
We can pass the variable in cursor by using parameter cursor. Just we give the variable in it like cursor C1 (my_variable number).
 What is the CASE statement and where we can use it?
CASE statement is just like IT-THEN-ELSE condition it is normally use when we are using some type of if else condition. When condition is founded true the case statement return the result and no further evaluating of data.
What is INDEX, when and where we can use it?
Index is using for performance tuning and also give us faster data retrieval of record from tables. Index can create on any column in table by default oracle B-Tree index.
Which operator that are not coming in Indexing?
NOT IN operator is not coming in indexing.
 How we can get limited rows in SQL?
We can get limited rows in oracle database by using ROWNUM or HAVING clause.
 What is the difference between Sub query and Co-related query?
One query contains more than one sub-query. The inner most query run first then second outer then third outer and so on. If we will not use relation on inner query to outer query then this query is called sub-query if we use relation then this query called Correlated query.
Example of Sub Query:
SELECT EMP_NAME, DEPTNO FROM EMP
WHERE EMP_NAME IN (SELECT EMP_NAME FROM DEPT)
Example of Correlated Query:
SELECT EMP_NAME, DEPTNO FROM EMP
WHERE EMP_NAME IN (SELECT EMP_NAME FROM DEPT WHERE EMP.DEPTNO = DEPT.DEPTNO)
 What is exception handling and how we can handle the exception in Oracle?
Exception is an error situation which arises during program execution. When an error occurs exception is raised normally execution is stopped and control transfers to exception handling part. Exception handlers are routines written to handle the exception. The exceptions can be internally defined User-defined exception. In oracle we can handle exception by using these statements.
EXCEPTION WHEN
DUP_VAL_ON_INDEX
NOT_LOGGED_ON
NO_DATA_FOUND
TOO_MANY_ROWS
VALUE_ERROR
 Can we define more than one exception in one block?
Yes we can define more than one exception in one block in oracle form builder like we will       use DUP_VAL_ON_INDEX and NO_DATA_FOUND simultaneously
 What is SQL sequence and what are their attributes?
Sequence is an Oracle object that is using for generating the sequence of number. IT=T is normally using for column that have primary key.
“CREATE SEQUENCE TRANS_ID_SEQ
START WITH 1
MAXVALUE 99999999
MINVALUE 1
NOCYCLE
NOCACHE
NOORDER”
 What is CYCLE AND NO CYCLE in sequence?
When we use “CYCLE” option in sequence and sequence reaches its MAXVALUE, it will start again from the MINVALUE. That is not good when we are using the sequence for primary key. In “NOCYCLE” option cursor did not start from minimum value again.
Can we design one view on another view?
Yes we can design one view on the other view.
 What are aggregate functions in Oracle?
Aggregate function are using in oracle with group by clause and with having clause. Avg, count, max, min, sum,
  How can we sort out our data in oracle?
We can sort out or data in oracle by using Order by clause. If we sort our data then we use this Order by Roll_Num AEC and fro descending order we will use Order by Roll_Num  Desc.
What is a PL/SQL package and what are the advantages of PL/SQL Packages?
A package is a collection of PL/SQL elements that are grouped together within a special BEGIN-END syntax.  A package is a schema object that groups logically related PL/SQL types, items, and subprograms.
Packages usually have two parts, a specification and a body, although sometimes the body is unnecessary. The specification (spec for short) is the interface to your applications; it declares the types, variables, constants, exceptions, cursors, and subprograms available for use. The body fully defines cursors and subprograms, and so implements the spec.
 What are the query and how many types of queries?
A database query is some type of syntax that is sent to database and get some data or information from the database. It is some type of communicator that is using for giving something and taking something from database.
  • Simple Query
  • Advanced Query
  • Saved Query
  • Cross-project Query
 What is the union, intersect and minus operation in oracle?
Create  table MY_A
(
My_ID number
)
Table A values: (1, 2, 3)
Create table MY_B
(
My_ID number
)
Table A values: (1, 2, 5)

For             UNION:
Select MY_ID from MY_A;
UNION
Select MY_ID from MY_B;
Result: 1, 2, 3,5

For             INTERSECT:
Select MY_ID from MY_A;
INTERSECT
Select MY_ID from MY_B;
Result: 1, 2

For             MINUS:
Select MY_ID from MY_A;
MINUS
Select MY_ID from MY_B;
Result: 3
 What is the difference between UNION and UNION ALL?
In UNION  if two rows will match then result come only of  two rows but if we use UNION ALL then result will be four rows.
Create  table MY_A
(
My_ID number
)
Table A values: (1, 2, 3)
Create table MY_B
(
My_ID number
)
Table B values: (1, 2, 5)
For             UNION:
Select MY_ID from MY_A;
UNION
Select MY_ID from MY_B;
Result: 1, 2, 3,5
For             UNION ALL:
Select MY_ID from MY_A;
UNION ALL
Select MY_ID from MY_B;
Result: 1,1, 2,2, 3,5

Explain in detail use of OCI in oracle?
OCI is an API that provides functions you can use to access the database server and control SQL execution. OCI supports the data types, calling conventions, syntax, and semantics of the C and C++ programming languages. You compile and link an OCI program much as you would any C or C++ program.
 Oracle function can take OUT parameter?
Yes we use OUT parameter in function.
 In form Parameter can we define default value?
Yes you can define initial value in form parameter.
 What is the difference between NO_DATA_FOUND and %NOTFOUND?
“NO_DATA_FOUND” is a system defined exception. It is generated when no record found in implicit cursor. “%NOTFOUND” is used in cursor. If cursor returns no row then %NOTFOUND returns true and if returns row then %NOTFOUND is false.
 Write a statement to find out the no. of rows in oracle?
Select count(*) from emp;
 Which function is use for display the numeric figure in words?
SELECT TO_CHAR(TO_DATE(123,'J'),'JSP') to_words FROM   dual;
What is the difference between WHERE clause and HAVING clause?
WHERE clause use in simple select statement on the other hand HAVING clause use in group function statement like.
Select emp_name from  WHEER dept_code=123;
Select emp_name from emp HAVING count(emp_cod) > 2;
 Write a difference between SUBSTR and INSTR function?
SUBSTR provide some portion of string like from one word to 5th word and INSTR gives us location   of that particular word.




32 comments:

  1. very good information .......

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Some us know all relating to the compelling medium you present powerful steps on this blog and therefore strongly encourage contribution from other ones on this subject while our own child is truly discovering a great deal. Have fun with the remaining portion of the year.

    Data Science training in Chennai | Data science training in bangalore
    Data science training in pune| Data science online training
    Python training in Kalyan nagar

    ReplyDelete
  6. Just stumbled across your blog and was instantly amazed with all the useful information that is on it. Great post, just what i was looking for and i am looking forward to reading your other posts soon!
    java training in jayanagar | java training in electronic city

    java training in chennai | java training in USA

    ReplyDelete
  7. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.

    Oracle Training in Chennai | Best Oracle Training Institute in Chennai
    Web Design Training in Chennai
    Web Design Training in Chennai|Best Web Design Training in Chennai

    ReplyDelete
  8. Attend The Python Training in Bangalore From ExcelR. Practical Python Training in Bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Python Training in Bangalore.

    ReplyDelete
  9. Nice information, valuable and excellent design, Thanks for sharing good ideas and concepts, lots of great information and inspiration. Keep it up!!
    Machine Learning Training in Bangalore

    ReplyDelete
  10. Attend The Data Analytics Courses in Bangalore From ExcelR. Practical Data Analytics Courses in Bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Data Analytics Courses in Bangalore.
    ExcelR Data Analytics Courses in Bangalore

    ReplyDelete
  11. It is an informative blog. I would like to know more information. Anyway thanks a lot for sharing this post. Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervour like mine to grasp great deal more around this condition.Data Science Training In Chennai

    Data Science Online Training In Chennai

    Data Science Training In Bangalore

    Data Science Training In Hyderabad

    Data Science Training In Coimbatore

    Data Science Training

    Data Science Online Training

    ReplyDelete
  12. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...data science courses

    ReplyDelete
  13. Its such as you learn my mind! You appeаr tо grasp ѕo much approximately this, such as you wrote the book in it or something.
    I think that you could ɗo wіth some percent to pressure the mesѕage home a little bit,
    but instead of that, this iѕ excellent blog. An excellent
    read. I ԝilⅼ defіnitely be back.

    java training in chennai

    java training in velachery

    aws training in chennai

    aws training in velachery

    python training in chennai

    python training in velachery

    selenium training in chennai

    selenium training in velachery

    ReplyDelete
  14. It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command
    hardware and networking training in chennai

    hardware and networking training in tambaram

    xamarin training in chennai

    xamarin training in tambaram

    ios training in chennai

    ios training in tambaram

    iot training in chennai

    iot training in tambaram

    ReplyDelete
  15. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
    web designing training in chennai

    web designing training in omr

    digital marketing training in chennai

    digital marketing training in omr

    rpa training in chennai

    rpa training in omr

    tally training in chennai

    tally training in omr

    ReplyDelete
  16. I am always searching online for articles that can help me. There is obviously a lot to know about this. I think you made some good points in Features also. Keep working, great job
    data scientist course in hyderabad

    ReplyDelete






  17. Infycle Technologies offers the best Data Science training in Chennai and is widely known for its excellence in giving the best Data Science Certification in Chennai. Providing quality software programming training with 100% placement & tcourseo build a solid career for every young professional in the software industry is the ultimate aim of Infycle Technologies. Apart from all, the students love the 100% practical training, which is the specialty of Infycle Technologies. To proceed with your career with a solid base, reach Infycle Technologies through 7502633633.
    Best Data Science Training in Chennai | Infycle Technologies









    ReplyDelete
  18. Title:
    Best Software Training Center in Chennai | Infycle Technologies

    Description:
    Reach to the best software training center in Chennai, Infycle Technologies to enter into the software industry with well-defined skills. Infycle Technologies is one of the rapidly developing software training cum placement centers in Chennai and is generally known for its significance in providing quality hands-on practical training with 100% guaranteed outcomes! Call 7502633633 to book a free demo and to avail the best offers.

    best training in Chennai

    ReplyDelete
  19. Reach to the best software training center in Chennai, Infycle Technologies to enter into the software industry with well-defined skills. Infycle Technologies is one of the rapidly developing software training cum placement centers in Chennai and is generally known for its significance in providing quality hands-on practical training with 100% guaranteed outcomes! Call 7502633633 to book a free demo and to avail the best offers.

    BEST SOFTWARE TRAINING IN CHENNAI

    ReplyDelete
  20. I see the greatest contents on your blog and I extremely love reading them.
    data scientist training in malaysia

    ReplyDelete
  21. Your content is nothing short of brilliant in many ways. I think this is engaging and eye-opening material. Thank you so much for caring about your content and your readers.
    data analytics training in hyderabad

    ReplyDelete
  22. Really impressed! Everything is very open and very clear clarification of issues. It contains true facts. Your website is very valuable. Thanks for sharing.
    data analytics course in hyderabad

    ReplyDelete
  23. Impressive blog and knowledgeable content. Please share more blogs with us. Thank you.
    Data Science Course Training in Hyderabad

    ReplyDelete