| Home / Oracle / Database |
|
Showing: 1-15 of 28 »»
Articles
|
||||||
|
Q: Can a view be updated/inserted/deleted? If Yes under what conditions ?
A: 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 command would you use to create a backup control file?
Alter database backup control file to trace.
Give the stages of instance startup to a usable state where normal users may access it.
STARTUP NOMOUNT - Instance startup
STARTUP MOUNT - The database is mounted
STARTUP OPEN - The database is opened
|
||||||
|
||||||
|
Q: What is ON DELETE CASCADE ?
A: When ON DELETE CASCADE is specified ORACLE maintains referential integrity by automatically removing dependent foreign key values if a referenced primary or unique key value is removed
|
||||||
|
||||||
|
Q: Explain UNION,MINUS,UNION ALL, INTERSECT ?
A: INTERSECT returns all distinct rows selected by both queries.MINUS - returns all distinct rows selected by the first query but not by the second.UNION - returns all distinct rows selected by either queryUNION ALL - returns all rows selected by either query, including all duplicates.
|
||||||
|
||||||
|
Q: What is CYCLE/NO CYCLE in a Sequence ?
A: CYCLE specifies that the sequence continues 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.
|
||||||
|
||||||
|
Q: What is the difference between Rule based optimization and Cost based optimization in Oracle SQL queries?
Rule based optimizer or RBO uses a set of rules to determine the execution plan for a given query. For example if there is an index on one of the columns used in where clause, then RBO will always use the index. The biggest problem with RBO is that it does not take the distribution of data into consideration and hence sometimes ends up slowing down the query.
|
||||||
|
||||||
|
Q: Emp table had an employee with salary 2000. I issued an update statement to set the salary to 3000. Then I issued a create table statement. However the create table command errored out. I want to rollback the earlier update statement. Can I do that?
ALL DDL statements are auto-commit. That means whenever you execute a DDL statement, all prior transactions get commited. Please note that the commit is issued before excuting the DDL. So even if the DDL statement errors out, commit would have happened.
|
||||||
|
||||||
|
Q: What are logical databases? What are the advantages/disadvantages of logical databases?
A: LDB consists of logically related tables grouped together – used for reading and processing data.
Advantages
No need of programming for retrieval , meaning for data selection
Easy to use standard user interface, have check completeness of user input.
Disadvantages Fast in case of lesser no. of tables But if the table is in the lowest level of hierarchy, all upper level tables should
|
||||||
|
||||||
|
Q: What is the meaning of data definition name (ddname) and dataset name (dsname) in the DD statement?
A: Data definition name is the eight character designation after the // of the DD statement. It matches the internal name specified in the steps executing program. In COBOL that's the name specified after the ASSIGN in the SELECT ASSIGN statement. Dataset name is the operating system (MVS) name for the file.
|
||||||
|
||||||
|
Q: Please explain the concepts of transaction, commit and rollback
A sequence of database modifications, i.e., a sequence of insert, update, and delete statements,is called a transaction.
These modifications are temporarily stored in the database system. They become permanent only after the statement commit; has been issued.
As long as the user has not issued the commit statement, it is possible to undo all modifications since the last commit. To undo modifications, one has to issue the statement
|
||||||
|
||||||
|
Q: Explain the concept of NULL
In SQL NULL means the value is unknown. This is not same as 0 or the empty string ''. To check if the value in a column is NULL we use the clause "IS NULL"
Select * from emp where sal IS NULL; This statement will return all records with salary as null. However the statement Select * from emp where sal = NULL will not return any records.
|
||||||
|
||||||
|
Q: Explain Normal Join
A normal join will look like the following
SELECT e.ename NAME, d.deptname DEPARTMENT
FROM emp e, dept d
WHERE e.deptno = d.deptno;
Here the tables emp and dept have been joined by the column deptno. Please note the use of table alias (emp e) and column alias (
|
||||||
|
||||||
|
Q: Please explain Outer Join in SQL
This is one of the areas that many students make a mistake and it is perhaps one of the most frequently asked question in interviews. So study it carefully.
In this type of join the query returns all rows from one table and selected number of rows from the second table.
For example say we want to find all employees from emp table
|
||||||
|
||||||
|
Q: how to know the days or months or years between two employees in emp table?
A:
Let us say you want to find the days between the hiredates of two employees with employee no 99 and 345. in that case you can use the following query
select emp1.hiredate - emp2.hiredate
from emp emp1, emp emp2
where emp1.eno = 99
and emp2.eno= 345
if you do not know the employee no but rather the name then
|
||||||
|
||||||
|
Q: What are the properties of the Relational tables?
A:
Relational tables have six properties:
Values are atomic.
Column values are of the same kind.
Each row is unique.
The sequence of columns is insignificant.
The sequence of rows is insignificant.
Each column must have a unique name.
.
|
||||||
|
||||||
Powered by
KBPublisher (Knowledge base software)

