Home / Interview Questions / Database Interview Questions / Database Interview Questions Part 4

Database Interview Questions Part 4

1.Define read-only replication and its uses?

Read only replication creates local copy of table data originating from one or more remote master tables. An application can query the data in a read-only table snapshot, but cannot insert, update, or delete rows in the snapshot of the data.

USAGE:

  • Can be treated as back ups of original.
  • For faster query performance, read only replication is used.

 

2.In which language Oracle has been developed?

Oracle has been developed using C Language.

 

3.What is RAW datatype?

RAW datatype is used to store values in binary data format. The maximum size for a raw in a table in 32767 bytes.

 

4.Whether any commands are used for Months calculation? If so, What are they?

In Oracle, months_between function is used to find number of months between the given dates.

Example is – Months_between(Date 1, Date 2)

 

5.What are nested tables?

Nested table is a data type in Oracle which is used to support columns containing multi valued attributes. It also hold entire sub table.

 

6.What is COALESCE function?

COALESCE function is used to return the value which is set to be not null in the list. If all values in the list are null, then the coalesce function will return NULL.

Coalesce(value1, value2,value3,…)

 

7.How do we represent comments in Oracle?

Comments in Oracle can be represented in two ways:

Two dashes(- -) before beginning of the line – Single statement

/*—— */ is used to represent it as comments for block of statement

 

8.What is DML?

Data Manipulation Language (DML) is used to access and manipulate data in the existing objects.  DML statements are insert, select, update and delete and it won’t implicitly commit the current transaction.

 

9.What is the difference between TRANSLATE and REPLACE?

Translate is used for character by character substitution.

Replace is used substitute a single character with a word.

 

10.How do we display rows from the table without duplicates?

Duplicate rows can be removed by using the keyword DISTINCT in the select statement.

 

11.What is the usage of Merge Statement?

Merge statement is used to select rows from one or more data source for updating and insertion into a table or a view. It is used to combine multiple operations.

 

12.What is NULL value in oracle?

NULL value represents missing or unknown data. This is used as a place holder or represented it in as default entry to indicate that there is no actual data present.

 

13.What is USING Clause and give example?

The USING clause is used to specify with the column to test for equality when two tables are joined.

Select * from employee join salary using employee ID[/sql]

Employee tables join with the Salary tables with the Employee ID.

 

14.What is key preserved table?

A table is set to be key preserved table if every key of the table can also be the key of the result of the join. It guarantees to return only one copy of each row from the base table.

 

15.What is the use of Aggregate functions in Oracle?

Aggregate function is a function where values of multiple rows or records are joined together to get a single value output. Common aggregate functions are

  • Average
  • Count
  • Sum

 

16.What do you mean by GROUP BY Clause?

A GROUP BY clause can be used in select statement where it will collect data across multiple records and group the results by one or more columns.

 

17.What is a sub query and what are the different types of subqueries?

Sub Query is also called as Nested Query or Inner Query which is used to get data from multiple tables. A sub query is added in the where clause of the main query.

There are two different types of subqueries:

Correlated sub query

A Correlated sub query cannot be as independent query but can reference column in a table listed in the from list of the outer query.

Non-Correlated sub query

This can be evaluated as if it were an independent query. Results of the sub query are submitted to the main query or parent query.

 

18.What is cross join?

Cross join is defined as the Cartesian product of records from the tables present in the join.

Cross join will produce result which combines each row from the first table with the each row from the second table.

 

19.What are temporal data types in Oracle?

Oracle provides following temporal data types:

Date Data Type – Different formats of Dates

TimeStamp Data Type – Different formats of Time Stamp

Interval Data Type – Interval between dates and time

 

20.How do we create privileges in Oracle?

A privilege is nothing but right to execute an SQL query or to access another user object. Privilege can be given as system privilege or user privilege.

GRANT user1 TO user2 WITH MANAGER OPTION;

 

21.What is VArray?

VArray is an oracle data type used to have columns containing multi valued attributes and it can hold bounded array of values.

 

22.What is the difference between rename and alias?

  • Rename is a permanent name given to a table or a column whereas Alias is a temporary name given to a table or column.
  • Rename is nothing but replacement of name and Alias is an alternate name of the table or column.

 

23.What is a View?

View is a logical table which based on one or more tables or views.  The tables upon which the view is based are called Base Tables and it doesn’t contain data.

 

24.What is a cursor variable?

A cursor variable is associated with different statements which can hold different values at run time. A cursor variable is a kind of reference type.

 

25.What are cursor attributes?

Each cursor in Oracle has set of attributes which enables an application program to test the state of the cursor. The attributes can be used to check whether cursor is opened or closed, found or not found and also find row count.

 

26.What are the different Oracle Database objects?

There are different data objects in Oracle –

Tables – set of elements organized in vertical and horizontal

Views  – Virtual table derived from one or more tables

Indexes – Performance tuning method for processing the records

Synonyms – Alias name for tables

Sequences – Multiple users generate unique numbers

Tablespaces – Logical storage unit in Oracle

27.What are the differences between LOV and List Item?

  • LOV is property whereas list items are considered as single item.
  • List items is set to be a collection of list of items.
  • A list item can have only one column.
  • LOV can have one or more columns.

 

28.What is the difference between $ORACLE_BASE and $ORACLE_HOME?

 

Oracle base is the main or root directory of an oracle whereas ORACLE_HOME is located beneath base folder in which all oracle products reside.

 

29.What is the maximum number of triggers that can be applied to a single table?

12 is the maximum number of triggers that can be applied to a single table.

 

30.How can we view last record added to a table?

Last record can be added to a table and this can be done by

Select * from (select * from employees order by rownum desc) where rownum<2;

 

31.What is the data type of DUAL table?

The DUAL table is a one-column table present in oracle database.  The table has a single VARCHAR2(1) column called DUMMY which has a value of ‘X’.

 

32.What is difference between Cartesian Join and Cross Join?

There are no differences between the join. Cartesian and Cross joins are same.

  • Cross join gives cartesian product of two tables 
  • Rows from first table is multiplied with another table which is called cartesian product.
  • Cross join without where clause gives Cartesian product.

About Syed Saad Ali

With 13 years of experience as a certified and skilled Oracle Database Administrator, I possess the expertise to handle various levels of database maintenance tasks and proficiently perform Oracle updates. Throughout my career, I have honed my analytical abilities, enabling me to swiftly diagnose and resolve issues as they arise. I excel in planning and executing special projects within time-sensitive environments, showcasing exceptional organizational and time management skills. My extensive knowledge encompasses directing, coordinating, and exercising authoritative control over all aspects of planning, organization, and successful project completions. Additionally, I have a strong aptitude for resolving customer relations matters by prioritizing understanding and effective communication. I am adept at interacting with customers, vendors, and management, ensuring seamless communication and fostering positive relationships.

Check Also

Apps Technical Interview Questions Part 5

[et_pb_section bb_built=”1″ _builder_version=”3.0.52″ background_image=”https://oraclesolutions.pk/wp-content/uploads/2017/07/question-mark-2123967_1920.jpg” parallax=”on” parallax_method=”off” inner_shadow=”on”][et_pb_row _builder_version=”3.0.52″ parallax=”on” parallax_method=”off” background_position_1=”top_left” background_repeat_1=”no-repeat” make_fullwidth=”on” use_custom_width=”on” custom_width_percent=”100%” …

Leave a Reply