Subquery Factoring or Common Table Expression (CTE)

Q1. What is Subquery Factoring? Answer. Subquery factoring is implemented with the usage of with clause. The WITH clause may be processed as an inline view or resolved as a temporary table. The advantage is that repeated references to the subquery may be more efficient as the data is easily retrieved from the temporary table,Continue reading “Subquery Factoring or Common Table Expression (CTE)”

Functions, Procedures & Packages

Q1. What are the various types of parameter modes in a procedure / function? Answer. IN, OUT AND INOUT. Q2. What is a transaction? Answer. A transaction is a set of SQL statements between any two COMMIT and ROLLBACK statements. Q3. What is Sysdate? A function or A pseudo column or A system defined variable?Continue reading “Functions, Procedures & Packages”

Cursors

Q1. What is a cursor? Why Cursor is required? Answer. Cursor is a named private SQL area from where information can be accessed. Cursors are required to process rows individually for queries returning multiple rows. Cursors are unidirectional only. Q2. What are cursor attributes? Explain them. Answer. Following are the cursor attributes:• %Found – toContinue reading “Cursors”

Indexes

Q1. What is the difference between foreign key and reference key? Answer. A Foreign key is the key which refers to another table’s primary key.A Reference key is the primary key of table referred by another table. Q2. Differentiate between Primary key and Unique Key Answer. Primary key and Unique key both enforces uniqueness ofContinue reading “Indexes”

Views & Materialized Views

Q1. Why are views created? Answer. Views are created for:• Storing complicated queries in the database so that they are not to be re-written every time they are required.• Hide the complicated logics on joins from the users.• Hide the sensitive data from the users by limiting their view to limited fields mentioned in views.•Continue reading “Views & Materialized Views”

Tables & External Tables

Q1. What are the various constraints that can be applied to a Table? Answer. NULL, NOT NULL, CHECK, DEFAULT, Primary Key & Foreign Key. Q2. What is the purpose of a CLUSTER? Answer. Oracle does not allow a user to specifically locate tables, since that is a part of the function of the RDBMS. However,Continue reading “Tables & External Tables”

General SQL & PL/SQL

Q1. Difference between DBMS & RDBMS Answer. DBMS RDBMS Data is stored in form of files. Data is stored in form of tables. Normalization is not applied. Normalization is applied. Relations between different data is not set as data is stored in form of files. Relationship between tables can be set as data is storedContinue reading “General SQL & PL/SQL”

Written Test Questions

Q1. From the following SQL Statements which one is the most reliable? Answer. E] is the most reliable statement. Q2. From the following statements which one will you prefer to use & why? Answer. B] as select will consume more time than PL/SQL code. Q3. Which relational operators in where clause results in non-usage ofContinue reading “Written Test Questions”