Showing posts with label Database Interview Question With Answer. Show all posts
Showing posts with label Database Interview Question With Answer. Show all posts

How many places to the right of the decimal can be stored in a CURRENCY data field?

The CURRENCY data type can store up to four places to the right of the decimal.

What is the highest value that can be stored in a BYTE data field?

The highest value that can be stored in a BYTE field is 255. or from
-128 to 127. Byte is a set of Bits that represent a single character.
Usually there are 8 Bits in a Byte, sometimes more, depending on
how the measurement is being made. Each Char requires one byte of
memory and can have a value from 0 to 255 (or 0 to 11111111 in
binary).

Write SQL query

Question : In the domain table we have status as a numeric value from 01 to 04 and we  have text definition of these values in the design document.
Write SQL query to see the result as a text definitions that is corresponded  to these values. (DB2)

Answer:  select TB1.member_id, TB1.bu_id, TB1.program,  TB2.num,
case TB1.status
when '01' then 'Auto renew'
when '02' then 'Expired'
when '03' then 'Sold'
when '04' then 'Terminated'

else TB_name.status
end
       from DB_name.TB_name1  TB1,
DB_name.TB_name2 TB2
       where
       TB1.program in ('com', 'org')
       and TB1.member_role  = '100'
       order by  TB1.member_id
       fetch first 30 rows only

What is transaction? In terms of Database

A. A transaction is a collection of applications code and database
manipulation code bound into an indivisible unit of execution.
it consists from:

BEGIN-TRANSACTION Name
Code
END TRANSACTION Name

What are the main components of Database management systems?

The database management system software includes components for
storage management, concurrency control, transaction
processing, database manipulation interface, database definition
interface, and database control interface.

What is query optimization?

Query optimization is the part of the query process in which the
database system compares different query strategies and chooses the
one with the least expected cost

What Oracle lock modes do you know?

Oracle has two lock modes: shared or exclusive.
Shared locks are set on database resources so that many transactions
can access the resource.
Exclusive locks are set on resources that ensure one transaction has
exclusive access to the database resource

What is Oracle locking?

Oracle uses locking mechanisms to protect data from being destroyed by
concurrent transactions.

Which of the following statements are Data Manipulation Language commands?

A. INSERT
B. UPDATE
C. GRANT
D. TRUNCATE
E. CREATE

How you will create a column alias? (Oracle 8i)

The AS keyword is optional when specifying a column alias. You must
enclose the column alias in double quotes when the alias
contains a space or lowercase letters. If you specify an alias in
lowercase letters without double quotes, the alias will appear in
uppercase.

Which operator do you use to return all of the rows from one query except rows are returned in a second query?

You use the MINUS operator to return all rows from one query except
where duplicate rows are found in a second query. The UNION operator
returns all rows from both queries minus duplicates. The UNION ALL
operator returns all rows from both queries including duplicates.
The INTERSECT operator returns only those rows that exist in both queries.

How Oracle executes a statement with nested subqueries?

When Oracle executes a statement with nested subqueries,it always executes the innermost query first. This query passes its results to the next query and so on until it reaches the outermost query.
It is the outermost query that returns a result set.