Top 50 Oracle Interview Questions and Answers | Questions for Freshers and Experienced | Edureka
Searching for a new job can be more difficult know a day even searching itself might become a big job for you. So, to clear all your confusions on interview locations, interview questions we have given detail on our Wisdomjobs site. To be precise about the Oracle 10g, 10g is Oracles network calculating product group counting (among other things) a database management system (DBMS) and an application server. If you are familiar with the Oracle 10g Concepts then there are Nemours companies that offer job positions like Principal Consultant, Oracle Database Administrator, Oracle WebLogic 11g Admin, Oracle DBA Consultant – Rac/10g/11g, Oracle Database Administrator, Senior Oracle Applications DBA, Oracle SOA Suite Administrator and many other roles too. For more details on Oracle 10g job Interview Questions and Answers and Oracle 10g jobs visit our site.
Oracle Basic Interview Questions
Q1. How will you differentiate between Varchar & Varchar2?
Both Varchar & Varchar2 are the Oracle data types which are used to store character strings of variable length. To point out the major differences between these,
Varchar | Varchar2 |
Can store characters up to 2000 bytes |
Can store characters up to 4000 bytes. |
It will hold the space for characters defined during declaration even if all of them are not used |
It will release the unused space |
Q2. What are the components of logical database structure in Oracle database?
The components of the logical database structure in Oracle database are:
Q3. Describe an Oracle table
A table is a basic unit of data storage in the Oracle database. A table basically contains all the accessible information of a user in rows and columns.
To create a new table in the database, use the “CREATE TABLE” statement. First, you have to name that table and define its columns and datatype for each column.
CREATE TABLE table_name ( column1 datatype [ NULL | NOT NULL ], column2 datatype [ NULL | NOT NULL ], … column_n datatype [ NULL | NOT NULL ] );
Q4. Explain the relationship among database, tablespace and data file?
An Oracle database possesses one or more logical storage units called tablespaces. Each tablespace in Oracle database consists of one or more files called the datafiles. These tablespaces collectively store the entire data of databases. Talking about the datafiles, these are the physical structure that confirms with the operating system as to which Oracle program is running.
Q5. What are the various Oracle database objects?
These are the Oracle Database Objects:
Tables: This is a set of elements organized in a vertical and horizontal manner. Tablespaces: It is a logical storage unit in Oracle. Views: Views are a virtual table derived from one or more tables. Indexes: This is a performance tuning method to process the records. Synonyms: It is a name for tables.
Q6. Explain about the ANALYZE command in Oracle?
This “Analyze” command is used to perform various functions on index, table, or cluster. The following list specifies the usage of ANALYZE command in Oracle:
Q7. What types of joins are used in writing subqueries?
A Join is used to compare and combine, this means literally join and return specific rows of data from two or more tables in a database.
There are three types of joins in SQL that are used to write the subqueries.
Q8. RAW datatype in Oracle
The RAW datatype in Oracle is used to store variable-length binary data or byte string values. The maximum size for a raw in a given table in 32767 bytes.
You might get confused as to when to use RAW, varchar, and varchar2. Let me point out the major differences between them. PL/SQL does not recognize the data type and hence, it cannot have any conversions when RAW data is transferred to different systems. This data type can only be queried or can be inserted in a table.
Q9. What is the use of Aggregate functions in Oracle?
An aggregate function in Oracle is a function where values of multiple rows or records are joined together to get a single value output. It performs the summary operations on a set of values in order to provide a single value. There are several aggregate functions that you can use in your code to perform calculations. Some common Aggregate functions are:
Q10. Explain Temporal data types in Oracle
Oracle mainly provides these following temporal data types:
Q11. What is a View?
A view is a logical table based on one or more tables or views. A View is also referred as a user-defined database object that is used to store the results of a SQL query, that can be referenced later in the course of time. Views do not store the data physically but as a virtual table, hence it can be referred as a logical table. The corresponding tables upon which the views are signified are called Base Tables and this doesn’t contain data.
Q12. How to store pictures on to the database?
It is possible to store pictures on to the database by using Long Raw Data type. This data type is used to store binary data of length 2GB. Although, the table can have only on Long Raw data type.
Q13. Where do you use DECODE and CASE Statements?
Both these statements Decode and Case will work similar to the if-then-else statement and also they are the alternatives for each of them. These functions are used in Oracle for data value transformation.
Example:
Select OrderNum, DECODE (Status,’O’, ‘Ordered’,’P’, ‘Packed,’ S’,’ Shipped’, ’A’,’Arrived’) FROM Orders;
Select OrderNum , Case(When Status=’O’ then ‘Ordered’ When Status =’P’ then Packed When Status=’ S’ then ’Shipped’ else ’Arrived’) end FROM Orders;
Both these commands will display Order Numbers with their respective Statuses like this,
Status O= Ordered Status P= Packed Status S= Shipped Status A= Arrived
Q14. What do you mean by Merge in Oracle and how can you merge two tables?
Merge statement is used to merge the data from two tables subsequently. It selects the data from the source table and then inserts/updates it in the other table based on the condition provided in the query. It is also useful in data warehousing applications.
Q15. What is the data type of DUAL table?
The Dual table is basically a one-column table that is present in the Oracle database. This table has a single Varchar2(1) column called Dummy which has a value of ‘X’.
SQL Interview Questions
Q16. Explain about integrity constraint?
An integrity constraint is actually a declaration that is defined as a business rule for a table column. They are used to ensure accuracy and consistency of data in the database. It can also be called as a declarative way to define a business rule for a table’s column. There are a few types, namely:
Q17. What is SQL and also describe types of SQL statements?
SQL stands for Structured Query Language. SQL is used to communicate with the server in order to access, manipulate and control data. There are 5 different types of SQL statements available. They are:
Q18. Briefly explain what is Literal? Give an example where it can be used?
A Literal is a string that contains a character, a number, or a date that is included in the Select list and which is not a column name or a column alias.
Also note that, Date and character literals must be enclosed within single quotes (‘ ‘), whereas you don’t have to do that for the number literals.
For example: Select last_name||’is a’||job_id As “emp details” from employee;
In this case, “is a” is literal.
Q19. How to display row numbers with the records?
In order to display row numbers along with their records numbers you can do this:
This above query will display the row numbers and the field values from the given table.
This query will display row numbers and the field values from the given table.
Q20. What is the difference between SQL and iSQL*Plus?
SQL |
iSQL*Plus |
It is a language |
It is an environment |
Character and date columns heading are left-justified and number column headings are right-justified |
Default heading justification is in Centre |
Cannot be Abbreviated (short forms) |
Can be Abbreviated |
Does not have a continuation character |
Has a dash (-) as a continuation character if the command is longer than one line |
Use Functions to perform some formatting |
Use commands to format data |
Q21. What are SQL functions? Describe in brief different types of SQL functions?
SQL Functions are a very powerful feature of SQL. These functions can take arguments but always return some value. There are two distinct types of SQL functions available. They are:
Types of Single-Row functions are:
Types of Multiple-Row functions:
Q22. Describe different types of General Function used in SQL?
General functions are of following types:
Q23. What is a Sub Query? Describe its Types?
A subquery is a SELECT statement that is embedded in a clause of another SELECT statement. A subquery can be placed in where having and from clause.
Guidelines for using subqueries:
Types of subqueries:
Q24. What is the use of Double Ampersand (&&) in SQL Queries? Give an example
You can use && if you want to reuse the variable value without prompting the user each time.
For example: Select empno, ename, &&column_name from employee order by &column_name;
Q25. Describe VArray
VArray is basically an Oracle data type used to have columns containing multivalued attributes and it can hold a bounded array of values. All Varrays consist of contiguous memory locations. The lowest address corresponds to the first element and the highest address to the last element.
Each element in a Varray has an index associated with it. It has a maximum size (max_size) that can be changed dynamically.
Q26. What are the attributes of the Cursor?
Each Cursor in Oracle has a set of attributes that enables an application program to test the state of the Cursor. The attributes can be used to check whether the cursor is opened or closed, found or not found and also find row count.
Q27. Name the various constraints used in Oracle
These are the following constraints used:
Q28. What is the fastest query method to fetch data from the table?
The fastest query method to fetch data from the table is by using the Row ID. A row can be fetched from a table by using RowID.
Q29. Difference between Cartesian Join and Cross Join?
There are no such differences between these Joins. Cartesian and Cross join are the same.
Cross join gives a cartesian product of two tables i.e., the rows from the first table is multiplied with another table that is called cartesian product.
Cross join without the where clause gives a Cartesian product.
Q30. How does the ON-DELETE-CASCADE statement work?
Using this On Delete Cascade you can automatically delete a record in the child table when the same record is deleted from the parent table. This statement can be used with Foreign Keys as well.
You can add this On Delete Cascade option on an existing table.
Syntax:
Alter Table Child_T1 ADD Constraint Child_Parent_FK References Parent_T1(Column1) ON DELETE CASCADE;
Now let’s move on to the next part of this Oracle Interview Questions article.
What is SQL and also describe types of SQL statements?
SQL stands for Structured Query Language. SQL is a language used to communicate with the server to access, manipulate, and control data.
There are 5 different types of SQL statements.
SELECT
INSERT
, UPDATE
, DELETE
, MERGE
CREATE
, ALTER
, DROP
, RENAME
, TRUNCATE
. COMMIT
, ROLLBACK
, SAVEPOINT
GRANT
, REVOKE
FAQ
What is the use of Oracle 10g?
What are the three 3 major components of Oracle database?
- List the various components of the physical database structure of an Oracle database. …
- The Oracle database has been developed using which language? …
- What do you understand about the logical storage structure of Oracle? …
- Define a tablespace in context with the Oracle database.