Analytical Functions

Q1. What is Rollup? Answer. ROLLUP produces group subtotals from right to left and a grand total. If “n” is the number of columns listed in the ROLLUP, then there will be n+1 levels of subtotals. FACT1_ID FACT2_ID SALES_VALUE 1 1 4363.55 1 2 4794.76 1 3 4718.25 1 4 5387.45 1 5 5027.34 1Continue reading “Analytical Functions”

Triggers

Q1. Explain two virtual tables available at the time of database trigger execution. Answer. :OLD and :NEW are the 2 virtual tables available at the time of database trigger execution. The table columns are referred as :OLD.column_name and :NEW.column_name. Trigger Event Availability of values in :NEW.column_name :OLD.column_name Insert Available Not Available Update Available Available DeleteContinue reading “Triggers”

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”

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”