How Are The Index Updates?
Indexes are automatically maintained and used by Oracle. Changes to table data are automatically incorporated into all relevant indexes.
What Is An Oracle Index?
An index is an optional structure associated with a table to have direct access to rows, which can be created to increase the performance of data retrieval. Index can be created on one or more columns of a table.
When A Query Is Sent To The Database And An Index Is Not Being Used, What Type Of Execution Is Taking Place?
A table scan.
What Is The Maximum Number Of Triggers, Can Apply To A Single Table?
12 triggers.
What Is The Output Of Sign Function?
1 for positive value,
0 for Zero,
-1 for Negative value.
What Are The More Common Pseudo-columns?
SYSDATE, USER , UID, CURVAL, NEXTVAL, ROWID, ROWNUM
What Are Pl/sql Cursor Exceptions?
Cursor_Already_Open, Invalid_Cursor
Any Three Pl/sql Exceptions?
Too_many_rows,
No_Data_Found,
Value_Error,
Zero_Error,
Others
To See Current User Name
Sql> show user;
If A View On A Single Base Table Is Manipulated Will The Changes Be Reflected On The Base Table?
If changes are made to the tables and these tables are the base tables of a view, then the changes will be reference on the view.
Can A View Be Updated/inserted/deleted? If Yes - Under What Conditions?
A View can be updated/deleted/inserted if it has only one base table if the view is based on columns from one or more tables then insert, update and delete is not possible.
What Are The Advantages Of View?
- To protect some of the columns of a table from other users.
- To hide complexity of a query.
- To hide complexity of calculations.
What Is Cycle/no Cycle In A Sequence?
CYCLE specifies that the sequence continue to generate values after reaching either maximum or minimum value. After pan-ascending sequence reaches its maximum value, it generates its minimum value. After a descending sequence reaches its minimum, it generates its maximum.
NO CYCLE specifies that the sequence cannot generate more values after reaching its maximum or minimum value.
Which Date Function Returns Number Value?
months_between
Display Odd/ Even Number Of Records
Odd number of records:
select * from emp where (rowid,1) in (select rowid, mod(rownum,2) from emp);
1
3
5
Even number of records:
select * from emp where (rowid,0) in (select rowid, mod(rownum,2) from emp)
2
4
6
To View Installed Oracle Version Information
SQL> select banner from v$version;
Find Out Nth Highest Salary From Emp Table
SELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal);
Enter value for n: 2
SAL
---------------
3700
Explicit Cursor Attributes
There are four cursor attributes used in Oracle
cursor_name%Found,
cursor_name%NOTFOUND,
cursor_name%ROWCOUNT,
cursor_name%ISOPEN
How Do I Display Row Number With Records?
To achive this use rownum pseudocolumn with query, like
SQL> select rownum, ename from emp;
Output:
-----------------
1 Scott
2 Millor
3 Jiyo
4 Smith
What Is The Difference Of A Left Join And An Inner Join Statement?
A LEFT JOIN will take ALL values from the first declared table and matching values from the second declared table based on the column the join has been declared on. An INNER JOIN will take only matching values from both tables
What Is An Advantage To Using A Stored Procedure As Opposed To Passing An Sql Query From An Application.
A stored procedure is pre-loaded in memory for faster execution. It allows the DBMS control of permissions for security purposes. It also eliminates the need to recompile components when minor changes occur to the database.
What Is A Cartesian Product? What Causes It?
A Cartesian product is the result of an unrestricted join of two or more tables. The result set of a three table Cartesian product will have x * y * z number of rows where x, y, z correspond to the number of rows in each table involved in the join. It is causes by specifying a table in the FROM clause without joining it to another table.
Why Is A Union All Faster Than A Union?
The union operation, you will recall, brings two sets of data together. It will *NOT* however produce duplicate or redundant rows. To perform this feat of magic, a SORT operation is done on both tables. This is obviously computationally intensive, and uses significant memory as well. A UNION ALL conversely just dumps collection of both sets together in random order, not worrying about duplicates.
What Are Some Advantages To Using Oracle's Create Database Statement To Create A New Database Manually?
You can script the process to include it in a set of install scripts you deliver with a product.
You can put your create database script in CVS for version control, so as you make changes or adjustments to it, you can track them like you do changes to software code.
You can log the output and review it for errors. You learn more about the process of database creation, such as what options are available and why.
What Are The Pros And Cons Of Using Triggers?
A trigger is one or more statements of SQL that are being executed in event of data modification in a table to which the trigger belongs.
Triggers enhance the security, efficiency, and standardization of databases.
Triggers can be beneficial when used:
to check or modify values before they are actually updated or inserted in the database. This is useful if you need to transform data from the way the user sees it to some internal database format.
to run other non-database operations coded in user-defined functions
to update data in other tables. This is useful for maintaining relationships between data or in keeping audit trail information.
Switch To Dos Prompt
SQL> host
How To Access The Current Value And Next Value From A Sequence? Is It Possible To Access The Current Value In A Session Before Accessing Next Value?
Sequence name CURRVAL, sequence name NEXTVAL. It is not possible. Only if you access next value in the session, current value can be accessed.
What Is A Database Link?
Database link is a named path through which a remote database can be accessed.
If Unique Key Constraint On Date Column Is Created, Will It Validate The Rows That Are Inserted With Sysdate?
It won’t, Because SYSDATE format contains time attached with it.
How Will You Activate/deactivate Integrity Constraints?
The integrity constraints can be enabled or disabled by ALTER TABLE ENABLE CONSTRAINT / DISABLE CONSTRAINT.
Where The Integrity Constraints Are Stored In Data Dictionary?
The integrity constraints are stored in USER_CONSTRAINTS.
What Are The Pre-requisites To Modify Datatype Of A Column And To Add A Column With Not Null Constraint?
- To modify the datatype of a column the column must be empty.
- To add a column with NOT NULL constrain, the table must be empty.
How Many Long Columns Are Allowed In A Table? Is It Possible To Use Long Columns In Where Clause Or Order By?
Only one LONG column is allowed. It is not possible to use LONG column in WHERE or ORDER BY clause.
What Is Difference Between Char And Varchar2? What Is The Maximum Size Allowed For Each Type?
CHAR pads blank spaces to the maximum length.
VARCHAR2 does not pad blank spaces.
For CHAR the maximum length is 255 and 2000 for VARCHAR2.
What Are The Data Types Allowed In A Table?
CHAR, VARCHAR2, NUMBER, DATE, RAW, LONG and LONG RAW.
Indexes are automatically maintained and used by Oracle. Changes to table data are automatically incorporated into all relevant indexes.
What Is An Oracle Index?
When A Query Is Sent To The Database And An Index Is Not Being Used, What Type Of Execution Is Taking Place?
A table scan.
What Is The Maximum Number Of Triggers, Can Apply To A Single Table?
12 triggers.
What Is The Output Of Sign Function?
1 for positive value,
0 for Zero,
-1 for Negative value.
What Are The More Common Pseudo-columns?
SYSDATE, USER , UID, CURVAL, NEXTVAL, ROWID, ROWNUM
What Are Pl/sql Cursor Exceptions?
Cursor_Already_Open, Invalid_Cursor
Dassault Systemes Most Frequently Asked Latest Oracle Interview Questions Answers |
Any Three Pl/sql Exceptions?
Too_many_rows,
No_Data_Found,
Value_Error,
Zero_Error,
Others
To See Current User Name
Sql> show user;
If A View On A Single Base Table Is Manipulated Will The Changes Be Reflected On The Base Table?
If changes are made to the tables and these tables are the base tables of a view, then the changes will be reference on the view.
Can A View Be Updated/inserted/deleted? If Yes - Under What Conditions?
A View can be updated/deleted/inserted if it has only one base table if the view is based on columns from one or more tables then insert, update and delete is not possible.
What Are The Advantages Of View?
- To protect some of the columns of a table from other users.
- To hide complexity of a query.
- To hide complexity of calculations.
What Is Cycle/no Cycle In A Sequence?
CYCLE specifies that the sequence continue to generate values after reaching either maximum or minimum value. After pan-ascending sequence reaches its maximum value, it generates its minimum value. After a descending sequence reaches its minimum, it generates its maximum.
NO CYCLE specifies that the sequence cannot generate more values after reaching its maximum or minimum value.
Which Date Function Returns Number Value?
months_between
Display Odd/ Even Number Of Records
Odd number of records:
select * from emp where (rowid,1) in (select rowid, mod(rownum,2) from emp);
1
3
5
Even number of records:
select * from emp where (rowid,0) in (select rowid, mod(rownum,2) from emp)
2
4
6
To View Installed Oracle Version Information
SQL> select banner from v$version;
Find Out Nth Highest Salary From Emp Table
SELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal);
Enter value for n: 2
SAL
---------------
3700
Explicit Cursor Attributes
There are four cursor attributes used in Oracle
cursor_name%Found,
cursor_name%NOTFOUND,
cursor_name%ROWCOUNT,
cursor_name%ISOPEN
How Do I Display Row Number With Records?
To achive this use rownum pseudocolumn with query, like
SQL> select rownum, ename from emp;
Output:
-----------------
1 Scott
2 Millor
3 Jiyo
4 Smith
What Is The Difference Of A Left Join And An Inner Join Statement?
A LEFT JOIN will take ALL values from the first declared table and matching values from the second declared table based on the column the join has been declared on. An INNER JOIN will take only matching values from both tables
What Is An Advantage To Using A Stored Procedure As Opposed To Passing An Sql Query From An Application.
A stored procedure is pre-loaded in memory for faster execution. It allows the DBMS control of permissions for security purposes. It also eliminates the need to recompile components when minor changes occur to the database.
What Is A Cartesian Product? What Causes It?
A Cartesian product is the result of an unrestricted join of two or more tables. The result set of a three table Cartesian product will have x * y * z number of rows where x, y, z correspond to the number of rows in each table involved in the join. It is causes by specifying a table in the FROM clause without joining it to another table.
Why Is A Union All Faster Than A Union?
The union operation, you will recall, brings two sets of data together. It will *NOT* however produce duplicate or redundant rows. To perform this feat of magic, a SORT operation is done on both tables. This is obviously computationally intensive, and uses significant memory as well. A UNION ALL conversely just dumps collection of both sets together in random order, not worrying about duplicates.
What Are Some Advantages To Using Oracle's Create Database Statement To Create A New Database Manually?
You can script the process to include it in a set of install scripts you deliver with a product.
You can put your create database script in CVS for version control, so as you make changes or adjustments to it, you can track them like you do changes to software code.
You can log the output and review it for errors. You learn more about the process of database creation, such as what options are available and why.
What Are The Pros And Cons Of Using Triggers?
A trigger is one or more statements of SQL that are being executed in event of data modification in a table to which the trigger belongs.
Triggers enhance the security, efficiency, and standardization of databases.
Triggers can be beneficial when used:
to check or modify values before they are actually updated or inserted in the database. This is useful if you need to transform data from the way the user sees it to some internal database format.
to run other non-database operations coded in user-defined functions
to update data in other tables. This is useful for maintaining relationships between data or in keeping audit trail information.
to check against other data in the table or in other tables. This is useful to ensure data integrity when referential integrity constraints aren’t appropriate, or when table check constraints limit checking to the current table only.
Switch To Dos Prompt
SQL> host
How To Access The Current Value And Next Value From A Sequence? Is It Possible To Access The Current Value In A Session Before Accessing Next Value?
Sequence name CURRVAL, sequence name NEXTVAL. It is not possible. Only if you access next value in the session, current value can be accessed.
What Is A Database Link?
Database link is a named path through which a remote database can be accessed.
If Unique Key Constraint On Date Column Is Created, Will It Validate The Rows That Are Inserted With Sysdate?
It won’t, Because SYSDATE format contains time attached with it.
How Will You Activate/deactivate Integrity Constraints?
The integrity constraints can be enabled or disabled by ALTER TABLE ENABLE CONSTRAINT / DISABLE CONSTRAINT.
Where The Integrity Constraints Are Stored In Data Dictionary?
The integrity constraints are stored in USER_CONSTRAINTS.
What Are The Pre-requisites To Modify Datatype Of A Column And To Add A Column With Not Null Constraint?
- To modify the datatype of a column the column must be empty.
- To add a column with NOT NULL constrain, the table must be empty.
How Many Long Columns Are Allowed In A Table? Is It Possible To Use Long Columns In Where Clause Or Order By?
Only one LONG column is allowed. It is not possible to use LONG column in WHERE or ORDER BY clause.
What Is Difference Between Char And Varchar2? What Is The Maximum Size Allowed For Each Type?
CHAR pads blank spaces to the maximum length.
VARCHAR2 does not pad blank spaces.
For CHAR the maximum length is 255 and 2000 for VARCHAR2.
What Are The Data Types Allowed In A Table?
CHAR, VARCHAR2, NUMBER, DATE, RAW, LONG and LONG RAW.
Post a Comment