How to change UserID and Password in Oracle. why do we use...

25
How to change UserID and Password in Oracle. what are differenct types of joins. explain outer join. How to print output in Oracle. what is a data control component. why do we use DBMS ? what are logical objects in RDBMS (tables & views). what do you know about IDL? can we maintain mirror data in different databases. Data Integrity constraint is (a)to ensure the presence of primary key What is indexing in databases? What is atomicity? What is DBMS and RDBMS ? types of DBMS,queries Difference between Unique and primary what is a cursor types of cursors normalization normal forms whis is the best normal form what is an os what exactly os consists ? Types of joins ? what is a trigger ? can we create a table in oracle which is not in first normal form difference between dbms and rdbms sql queries

Transcript of How to change UserID and Password in Oracle. why do we use...

Page 1: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

How to change UserID and Password in Oracle. what are differenct types of joins. explain outer join. How to print output in Oracle. what is a data control component. why do we use DBMS ? what are logical objects in RDBMS (tables & views). what do you know about IDL? can we maintain mirror data in different databases. Data Integrity constraint is (a)to ensure the presence of primary key What is indexing in databases? What is atomicity? What is DBMS and RDBMS ? types of DBMS,queries Difference between Unique and primary what is a cursor types of cursors normalization normal forms whis is the best normal form what is an os what exactly os consists ? Types of joins ? what is a trigger ? can we create a table in oracle which is not in first normal form difference between dbms and rdbms sql queries

Page 2: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

types of indexing DML,DDL, SQL querry,primary key, whts a null diff btw DDL,DML, whts parallel DML, whts normalisation explain with example till 3NF 6>need for normalisation differnce btw oracle 8.0,8i,9i what are pseudocolumns? given example. (CURRVAl,LEVEL,NEXTVAL,ROWID,ROWNUM) what are synonyms ? example. ( an alias name to the table , which is used for location transperancy.) CREATE SYNONYM emp2 FOR emp@newyork; SELECT ename, job INTO my_ename, my_job FROM emp2 WHERE empno = my_empno; what are snapshots. what is indexing. what are its advantages. what is cluster. advantages. how do you add primary key to the table already existing. what is table space. what partitioning. how many types of partitions. what is mutating table. When a table is in state of transition it is said to be mutating. eg :: If a row has been deleted then the table is said to be mutating and no operations can be done on the table except select. what is the keyword type. what is 'exists'. what is a cursor. what are the types. two types of cursors: implicit and explicit. PL/SQL declares a cursor implicitly for all

Page 3: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

SQL data manipulation statements, including queries that return only one row. However, for queries that return more than one row, you must declare an explicit cursor or use a cursor FOR loop. three commands to control the cursor: OPEN, FETCH, and CLOSE. initialize the cursor with the OPEN statement, which identifies the active set. Then, you use the FETCH statement to retrieve the first row. You can execute FETCH repeatedly until all rows have been retrieved. release the cursor with the CLOSE statement. DECLARE CURSOR c1 IS SELECT ename FROM emp; name1 emp.ename%TYPE; name2 emp.ename%TYPE; name3 emp.ename%TYPE; BEGIN OPEN c1; FETCH c1 INTO name1; -- this fetches first row FETCH c1 INTO name2; -- this fetches second row FETCH c1 INTO name3; -- this fetches third row ... CLOSE c1; END; four attributes of cursor : %NOTFOUND, %FOUND, %ROWCOUNT, and %ISOPEN what is SGA. The SGA is a shared memory region allocated by the Oracle that contains Data and control information for one Oracle Instance.

Page 4: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

It consists of Database Buffer Cache and Redo log Buffer. how do you override function/procedures in oracle. what is raise_application_error. what are datafiles. what are the default table spaces. what are the background processes in oracle. what are control files. what are the minimum privilege for the user to connect database. what is a role. why do you create it. Software Engineering ~~~~~~~~~~~~~~~~~~~~ what is waterfall model, prototype model etc. what is testing. what is unit testing, integration testing etc. what are the stages in software project. (study,analysis,design,development,testing,implementation) what is done in each stage of the SDLC. what is the output of analysis stage. what is er-model. how do you compare an entity with class or object. how do you design a project. Procedure of any model testing procedure of software Models-Spiral, Prototyping, Estimation models Software Configuration Management process is - Capability Maturity Model( 5 stages) Flow chart details Software Development Life Cycle where is development ? Why do we go for Testing ?

Page 5: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

Types of Testing ? Software Life Cycle ? what is testing Funtional point model difference between black box and white box what is quality and various quality certifications what is spiral lifecycle model Cohesion and coupling

ORACLE

Doubts :

• WHAT R SYNONYMS AND SEQUENCES IN PL/SQL;

• how can you store a image in the database.

• what do you mean by where current of C1

• LONG RAW data type is used for storing BLOB's (binary large objects).( ie graphics and images)

• what is soundex built in function

• what is to_number, to_char.

Integrity : the quality or state of being complete; unbroken condition; wholeness; entirety .

Consistency : agreement, holding firmly.

Constrain : to force into, or hold in, close bounds

Introduction to Oracle Oracle is a comprehensive operating environment that packs the power of mainframe

relation database management system into user’s micro computer. It provides a set of functional

programs that user can use as tools to build structures and perform tasks. Because applications are

developed on oracle are completely portable to the other versions of the programmer can create a

Page 6: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

complex application in a single user, environment and them move it to a multi user platform.Users

do not have to be an expert to appriciate Oracle but the better user understand the program,the

more productively and creatively he can use the tools it provides

Relational Database Management system

A Relational Database Management System (RDBMS) can perform a wide

range of tasks. It acts as a transparent interface between the physical storage and the logical

presentation of data.It provides a set of more or less flexible and sofesticated tools for handling

information.

Users can use the tools to

• Define a Database

• Query the Database

• Add,Edit and Delete data.

• Modify the structure of the Database.

• Communicate with in the Networks.

• Exports and Imports the data.

• Security.

Oracle the Right Tool

To keep track of records is often the best reason to consider buying a

software package.Choosing a proven product increase the chance that we will get a system capable

of meeting all our needs .Oracle has had many years in the relational market to often on the

large,Complex applications. Although Oracle demands greater expertise on the part of the

application developed,an application developed oracle will be able to keep pace with growth and

change in the world at large.

Oracle Gives You Security and Control

Oracle has several features that ensure the integrity of the data base. If an interruption

occurs in processing, a Rollback can reset the database to a point before the disaster. If a restore is

necessary, Oracle has a Roll forward command for recreating your database to its mast resent save

point.

Oracle provides user with several functions for securing data. Grant and Revoke

commands limit access to information down to the row and column levels. Views are valuable

feature for limiting access to the primary tables in the database.

The Oracle Environment

Oracle is a modular system that consists of the Oracle database and several functional

programs. Oracle’s tools do four major things of work.

1. Database Management.

2. Data access and Manipulation.

3. Programming

4. Connectivity.

Database Management Tools

This (is usually known as RDBMS by oracle) includes the core programs for Oracle’s

database management system, the Oracle database with its associated tables and views, which are

stores information related to every fact of the database system.User name, user access rights, table

attribute, storage information and auditing data for disaster recovery are stored in the data

dictionary.

Page 7: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

The Database Administrator

The person responsible for a Database is called the DatabaseAdministrator(DBA).The

DBA has a special set of previleges and has complete over the database.Any system with more

than one user should have a DBA.The function of DBA include.

Creating primary database storage structures.

Modifying the structure of the database.

Backing up and restoring the database.

Monitoring database performance and efficiency.

Transfering data between database and external files.

Manipulating the phisical location of the database.

THE END USER

End user have less complex but equally important tasks.They must be able to

• Query the database.

• Generate printed output.

• Share data with or secure data from others.

• Use non-export methods to update the database.

• Define applications from a user point of view.

WHY ORACLE ?

Oracle is an open system i.e. the database is accessing by different data access

languages like SQL, Visual Basic, Power Builders,Delphi,VC++,JAVA etc.

Oracle supports database upto gigabytes in size.

* Oracle supports large number of concurrent users.

* Oracle supports true client/server environment.if enable processing to be spilt between

database server and the client application programs.

* Oracle provides high levelof data security in terms of users, passwords privileges, and

permissions.

* Oracle database behaves same on all platform line Windows,Unix,Dos,Mainframes etc.

Structure of Oracle Database:

physical structure:

one or more data files, Two of more log files, One control file.

Logical structure:

Table spaces,

Segments, Extents, Data blocks.

The data files contain all user data in terms of tables, index, and views. The log files

contain the information to open and be recovered, of Undone after a transaction(Rollback).

The control file physical data, media information to open and manage data files .If the

control file is damaged the server will not be able to open are use the database even if the

database is undamaged.

What are the Back ground processes in Oracle and what are they. ? There are basically 9 Processes but in a general system we need to mention the first five

background processes. They do the house keeping activities for the Oracle and are common in

any system.

Page 8: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

a) Data Base Writer(DBWR) ::

Data Base Writer Writes Modified blocks from Database buffer cache to Data Files.This is

required since the data is not written whenever a transaction is commited.

b)LogWriter(LGWR) ::

LogWriter writes the redo log entries to disk. Redo Log data is generated in redo log buffer

of SGA. As transaction commits and log buffer fills, LGWR writes log entries into a online redo

log file.

c) System Monitor(SMON) ::

The System Monitor performs instance recovery at instance startup. This is useful for

recovery from system failure.

d)Process Monitor(PMON) ::

The Process Monitor peforms process recovery when user Process fails. Pmon Clears and

Frees resources that process was using.

e) CheckPoint(CKPT) ::

At Specified times, all modified database buffers in SGA are written to data files by

DBWR at Checkpoints and Updating all data files and control files of database to indicate the

most recent checkpoint.

f)Archieves(ARCH) ::

The Archiver copies online redo log files to archival storal when they are busy.

g) Recoveror(RECO) ::

The Recoveror is used to resolve the distributed transaction in network

h) Dispatcher (Dnnn) ::

The Dispatcher is useful in Multi Threaded Architecture

i) Lckn ::

We can have upto 10 lock processes for inter instance locking in parallel sql.

NORMALIZATION

Normalization is a process of simplifying the relationship between data elements in a

record. Through Normalization a collection of data in a record structure is replaced by successive

record structures that are simpler and more predictable and therefore more manageable. It is

process of reducing redundancy and eliminating the anomalies. (anamali means inconsistent state.)

Normalization is carried out for four reasons:

• To Structure the data so that any pertinent relationships between entities can be

represented.

• To permit simple retrieval of data in response to query and report requests.

• To simplify the maintenance of the data through updates, insertions, and deletion

• To reduce the need to restructure or reorganize data when new application requirements

arise.

• Normalization can improve the quality of design for an application.

There are totally Five Normal Forms(Rules) out of which, any database should necessarily satisfy

three of them, those Three Normal Forms are as follows:

First normal form is achieved when all repeating groups are removed so that a record is

of fixed length. A repeating group, the re-occurrence of a data item within a record, is actually

another relation. Hence, it is removed from the record and treated as an additional record structure,

or relation.

Page 9: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

Second Normal form should be in first normal form and no partial dependency exists.

Means if we have a composite primary key(combination of 2 or more fields) then all the non keys

must depend on the composite primary key. no attribute should depend upon the part of key.(for

example if Rollno and SSno is a composite key, then no other field in that particular table should

be depedent upon either Rollno or ssno individually)

Third Normal form is achieved when Transitive Dependencies are removed from a record

design.

The general case is as follows :

A,B and C are three data items in a record. If C is functionally dependent on B (2nd N.F) and

B is functionally dependent on A Then C is functionally dependent on A Therefore, a Transitive

Dependency exists.

In data management, transitive dependency is a concern because data can inadvertently be

lost when the relationship is hidden. In the general case above, if A is deleted, then B and C are

deleted also, whether or not this is intended. This problem is eliminated by designing the record

for third normal form. Conversion to third normal form removes the transitive dependency by

splitting the relation into two separate relations.

BCNF must be 3NF and every determinant is a candidate key. Candidate key is other than

primary key, which uniquely identify each row in the table.

for example ssno is PK then rollno becomes Candidate key.

4NF and 5NF are depends on instance. we can not give a proper def.

bcz it all depends on joins.

“CODD’s 12 RULES" for a fully Relational DBMS

INTRODUCTION

According to Elmasri and Navathe (1994), Dr. E. F. Codd, the originator of the relational

data model, published a two-part article in ComputerWorld (Codd, 1985) that lists 12 rules for

how to determine whether a DBMS is relational and to what extent it is relational. These rules

provide a very useful yardstick for evaluating a relational system. Codd also mentions that,

according to these rules, no fully relational system is available yet. In particular, rules 6, 9, 10, 11,

and 12 are difficult to satisfy.

THE 12 RULES

Rule 1: The Information Rule

All information in a relational database is represented explicitly at the logical level in

exactly one way by values in tables.

All data is represented in the form of relations/tables (with rows and columns)Simple

Consistent and versatile

Rule 2: Guaranteed Access Rule

Each and every datum (atomic value) in a relational database is guaranteed to be logically

accessible by resorting to a table name, primary key value, and column name. All Data is uniquely

identified and accessible via this identity.

Page 10: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

Rule 3: Systematic Treatment of Null Values

Null values (distinct from empty character string or a string of blank characters and distinct

from zero or any other number) are supported in the fully relational DBMS for representing

missing information in a systematic way, independent of data type.

Rule 4: Dynamic On-line Catalog based on the Relational Model

The database description is represented at the logical level in the same way as ordinary

data, so authorized users can apply the same relational language to its interrogation as they apply

to regular data.

Rule 5: Comprehensive Data Sublanguage Rule

A relational system may support several languages and various modes of terminal use (for

example, the fill-in-blanks mode). However, there must be at least one language whose statements

are expressible, per some well-defined syntax, as character strings and whose ability to support all

of the following is comprehensible: data definition, view definition, data manipulation (interactive

and by program), integrity constraints, and transaction boundaries (begin, commit, and rollback).

Rule 6: View Updating Rule

All views that are theoretically updateable are also updateable by the system.

Views are virtual tables. They appear to behave as conventional tables except that they are built

dynamically when the query is run. This means that a view is always up to date. It is not always

theoretically possible to update views. One problem exists when a view relates to part of a table

not including a candidate key. This means that potential updates would violate the entity integrity

rule.

Rule 7: High-level Insert, Update, and Delete

The capability of handling a base relation or a derived relation as a single operand applies

not only to the retrieval of data but also to the insertion, update, and deletion of data. i.e. The user

should be allowed to Delete, Update a set of tuples (rather than row by row)

Rule 8: Physical Data Independence

Application programs and terminal activities remain logically unimpaired whenever any

changes are made in either storage representation or access methods. i.e. Users and programs are

not dependent on the physical structure of the database.

Rule 9: Logical Data Independence

Application programs and terminal activities remain logically unimpaired when

information-preserving changes of any kind that theoretically permit unimpairment are made to

the base tables. Users and Programs are independent of the logical structure of the database, i.e.

the logical structure of the data can evolve with minimal impact on the programs.

Rule 10: Integrity Independence

Integrity constraints specific to a particular relational database must be definable in the

relational data sublanguage and storable in the catalog, not in the application programs. A

minimum of the following two integrity constraints must be supported:

1. Entity integrity: No component of a primary key is allowed to have a null value.

2. Referential integrity: For each distinct non-null foreign key value in a relational database,

there must exist a matching primary key value from the same domain.

Page 11: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

Rule 11: Distribution Independence

A relational DBMS has distribution independence. Distribution independence implies that

users should not have to be aware of whether a database is distributed. Applications should still

work in a distributed database (DDB).

Rule 12: Nonsubversion Rule

If a relational system has a low-level (single-record-at-a-time) language, that low-level

language cannot be used to subvert or bypass the integrity rules or constraints expressed in the

higher-level (multiple-records-at-a-time) relational language.

If there is a record at a time interface (e.g. via 3GL), Security and integrity of the database

must no be violated. There should be no backdoor to bypass the security imposed by the DBMS.

On the basis of the above rules, there is no fully relational DBMS available today.

Questions and Answers :

What is Pseudo Colomn ? USER, UID, SYSDATE, ROWNUM, ROWID, NULL, AND LEVEL

How to Display output in PL/SQL ?

we first set serveroutput on at SQL Prompt. and then in sql programming we specify as

dbms_output.put_line(‘hdjhd’ || ‘sakdha’);

No Displays are allowed in PL/SQL programming with select statement

Write about Commands and Keywords ?

Alter : ALTER TABLE EMP ADD ………. , MODIFY ………. ;

for a in 1..10 loop ……….. end loop;

loop exit when a<1 ……………… end loop;

while ….. loop……………..end loop;

Data Types : number, integer, varchar2, char, date, Boolean;

goto procedure name;…………..<<procedure name>>…………..

exit, rollback, commit, savepoint.

References: This keyword is used to refer two similar fields of different tables.

What are different built in functions ?

CONCATENATE, INITCAP, LENGTH, LOWER, UPPER, LPAD, RPAD, LTRIM

(removes the character specified left side of word), RTRIM, SUBSTR (displays values from

specified location onwards), TRANSLATE (for single character), REPLACE (for more than one

character ),CHR ( prints character of given ASCII value), ASCII (value of given character ).

ABS, CEIL, FLOOR, SQRT, POWER, SIGN, TRUNC, ROUND, EXP, MOD, LOG, LN,

GREATEST, LEAST, SYSDATE, ADD_MONTHS, MONTHS_BETWEEN.

what are emp.sal%type and emp%rowtype ?

First one is to assign a variable of type sal only.

Second is to assign a complete row of type emp table.

What are constraints ?

Page 12: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

Constraint Clause : This will constrain a single column or a group of columns in a table.

and are used for maintaining integrity of the database.

Different Constraints are : candidate keys, primary keys, foreign keys, check conditions.

Can specify as a part of column definition, or at the end of the table (if more than one column).

Check Constraint : for validations to fields.

Naming Constraint (table constraints): Can name the constraint else system will name it

by default.

Different types of joins ?

Equi join : where emp.deptno = dept.deptno;

Non Equi join : where e.sal >= g.losal;

Outer join :***********e.deptno(+)=d.deptno;

Different types of Keys ?

Foreign Key : This is a referential integrity constraint and specifies the values of primary

key in other table. and is mentioned as :

DEPTNO number(2) REFERENCES DEPT(DEPTNO);

The clause ON DELETE CASCADE added to REFERENCES clause tells Oracle to delete the

dependent rows when we delete the row in the parent table.

Unique Key : If declared, then does not accept duplicate and also NULL values. And can

have many Unique key fields.

Primary Key : Similar to Unique key but, also maintains an index on primary key and also

used to connect two tables.

Write about cursors ?

Implicit (SQL is implicit by default ) and Explicit cursors.

EXIT WHEN C1%NOTFOUND, IF C1%FOUND THEN, IF C1%ISOPEN THEN,

FOR LOOP in CURSOR will :

1) open the cursor.

2) fetches the records from cursor one by one.

3) keeps the track of number of records in the cursor.

Super Dynamism in Cursors is obtained by passing the values as parameters( ie pass by value)

ie., for x in c1(a,b)

Multiple Cursors : These are nothing but nested cursors………..

In Implicit Cursors there is no need of declaration of cursors, by default system will create

a cursor whenever a query is written…and the conditions are like if SQL%NOTFOUND

if SQL%ROWCOUNT > 2 will keep a count of the number of records updated.

SQL is a keyword and cannot be used to name as a cursor name explicitly.

Difference between group functions and single row functions ?

Group Function Single Row Function

A group function operates A single row function

on many rows returns one and result for one row.

returns single result.

Not allowed in Pl/sql procedural Allowed in Pl/Sql Procedural statements

eg SUM(),AVG,MIN,MAX etc eg UPPER,LOWER,CHR...

Difference between DECODE and TRANSLATE ?

DECODE is value by value TRANSLATE is character by

character replacement. replacement.

Page 13: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

Ex SELECT DECODE('ABC','A',1,'B',2,'ABC',3) eg SELECT

from dual; o/p 3 TRANSLATE('ABCGH',

'ABCDEFGHIJ', 1234567899)

FROM DUAL; o/p 12378

(DECODE command is used to bring IF,THEN,ELSE logic to SQL.It tests for the IF values(s) and

then aplies THEN value(s) when true, the ELSE value(s) if not.)

Difference between TRUNCATE and DELETE ?

TRUNCATE deletes much faster than DELETE

Truncate Delete

It is a DDL statement It is a DML statement

It is a one way trip,cannot One can Rollback

ROLLBACK

Doesn't have selective features (where clause) Has

Doesn't fire database triggers Does

It requires disabling of referential Does not require

constraints.

What is a CO-RELATED SUBQUERY ?

A CO-RELATED SUBQUERY is one that has a correlation name as table or view designator in

the FROM clause of the outer query and the same correlation name as a qualifier of a search

condition in the WHERE clause of the subquery.

eg SELECT field1 from table1 X WHERE field2>(select avg(field2) from table1 Y

where field1=X.field1);

(The subquery in a correlated subquery is revaluated

for every row of the table or view named in the outer query.)

What are various joins used while writing SUBQUERIES ?

Self join-Its a join foreign key of a table references the same table.

Outer Join--Its a join condition used where One can query all the rows of one of the

tables in the join condition even though they don't satisfy the join condition.

Equi-join--Its a join condition that retrieves rows from one or more tables in which one

or more columns in one table are equal to one or more columns in the second table.

What are various constraints used in SQL ?

NULL, NOT NULL, CHECK, DEFAULT

What are different Oracle database objects ?

TABLES, VIEWS, INDEXES, SYNONYMS, SEQUENCES, TABLESPACES etc

What is difference between Rename and Alias ?

Rename is a permanent name given to a table or column whereas Alias is a temporary

name given to a table or column which do not exist once the SQL statement is executed.

What is a view ?

A view is stored procedure based on one or more tables, it’s a virtual table.

What are various privileges that a user can grant to another user ?

SELECT, CONNECT, RESOURCES

What is difference between UNIQUE and PRIMARY KEY constraints ?

Page 14: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

A table can have only one PRIMARY KEY whereas there can be any number of UNIQUE

keys. The columns that compose PK are automatically define NOT NULL, whereas a column that

compose a UNIQUE is not automatically defined to be mandatory must also specify the column is

NOT NULL.

Can a primary key contain more than one columns ?

Yes

How you will avoid duplicating records in a query ?

By using DISTINCT

What is difference between SQL and SQL*PLUS ?

SQL*PLUS is a command line tool where as SQL and PL/SQL language interface and

reporting tool. Its a command line tool that allows user to type SQL commands to be executed

directly against an Oracle database. SQL is a language used to query the relational

database(DML,DCL,DDL). SQL*PLUS commands are used to format query result, Set options,

Edit SQL commands and PL/SQL.

Which datatype is used for storing graphics and images ?

LONG RAW data type is used for storing BLOB's (binary large objects).

How will you delete duplicating rows from a base table ?

DELETE FROM table_name A WHERE rowid>(SELECT min(rowid) from table_name B where

B.table_no=A.table_no);

CREATE TABLE new_table AS SELECT DISTINCT * FROM old_table;

DROP old_table

RENAME new_table TO old_table

DELETE FROM table_name A

WHERE rowid NOT IN (SELECT MAX(ROWID) FROM table_name

GROUP BY column_name)

What is difference between SUBSTR and INSTR ?

SUBSTR returns a specified portion of a string eg SUBSTR('BCDEF',4) output BCDE

INSTR provides character position in which a pattern is found in a string.

eg INSTR('ABC-DC-F','-',2) output 7 (2nd occurence of '-')

There is a string '120000 12 0 .125' ,how you will find the position of the decimal place ?

INSTR('120000 12 0 .125',1,'.')

output 13

There is a '%' sign in one field of a column. What will be the query to find it ? '\' Should be used before '%'.

When you use WHERE clause and when you use HAVING clause ? HAVING clause is used when you want to specify a condition for a group function and it is

written after GROUP BY clause

The WHERE clause is used when you want to specify a condition for columns, single row

functions except group functions and it is written before GROUP BY clause if it is used.

Which is more faster - IN or EXISTS ?

Page 15: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

EXISTS is more faster than IN because EXISTS returns a Boolean value whereas IN

returns a value.

What is a OUTER JOIN ?

Outer Join--Its a join condition used where you can query all the rows of one of the tables

in the join condition even though they don’t satisfy the join condition.

What is a pseudo column. Give some examples ?

It is a column that is not an actual column in the table.

eg USER, UID, SYSDATE, ROWNUM, ROWID, NULL, AND LEVEL.

Suppose customer table is there having different columns like customer no, payments.What

will be the query to select top three max payments ?

SELECT customer_no, payments from customer C1 WHERE 3<=(SELECT COUNT(*) from

customer C2 WHERE C1.payment <= C2.payment)

What is the purpose of a cluster ?

Oracle does not allow a user to specifically locate tables, since that is a part of the function

of the RDBMS. However, for the purpose of increasing performance, oracle allows a developer

to create a CLUSTER. A CLUSTER provides a means for storing data from different tables

together for faster retrieval than if the table placement were left to the RDBMS.

What is a cursor ?

Oracle uses work area to execute SQL statements and store processing information PL/SQL

construct called a cursor lets you name a work area and access its stored information A cursor is a

mechanism used to fetch more than one row in a PL/SQL block.

Difference between an implicit & an explicit cursor ?

PL/SQL declares a cursor implicitly for all SQL data manipulation statements, including

quries that return only one row. However,queries that return more than one row you must declare

an explicit cursor or use a cursor FOR loop.

Explicit cursor is a cursor in which the cursor name is explicitly assigned to a SELECT

statement via the CURSOR...IS statement. An implicit cursor is used for all SQL statements

Declare, Open, Fetch, Close. An explicit cursors are used to process multirow SELECT statements

An implicit cursor is used to process INSERT, UPDATE, DELETE and single row SELECT.

.INTO statements.

What are cursor attributes ?

%ROWCOUNT, %NOTFOUND, %FOUND, %ISOPEN

What is a cursor for loop ?

Cursor For Loop is a loop where oracle implicitly declares a loop variable, the loop index

that of the same record type as the cursor's record.

Difference between NO DATA FOUND and %NOTFOUND ?

NO DATA FOUND is an exception raised only for the SELECT....INTO statements when the

where clause of the querydoes not match any rows. When the where clause of the explicit

cursor does not match any rows the %NOTFOUND attribute is set to TRUE instead.

What a SELECT FOR UPDATE cursor represent ?

Page 16: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

SELECT......FROM......FOR......UPDATE[OF column-reference][NOWAIT] The

processing done in a fetch loop modifies the rows that have been retrieved by the cursor.

A convenient way of modifying the rows is done by a method with two parts: the FOR

UPDATE clause in the cursor declaration, WHERE CURRENT OF CLAUSE in an UPDATE or

declaration statement.

What 'WHERE CURRENT OF ' clause does in a cursor ?

LOOP SELECT num_credits INTO v_numcredits FROM classes WHERE dept=123 and

course=101;

UPDATE students SET current_credits=current_credits+v_numcredits WHERE CURRENT OF

X;

END LOOP

COMMIT;

END;

What is use of a cursor variable? How it is defined ?

A cursor variable is associated with different statements at run time, which can hold

different values at run time. Static cursors can only be associated with one run time query. A

cursor variable is reference type(like a pointer in C).

Declaring a cursor variable:

TYPE type_name IS REF CURSOR RETURN return_type type_name is the name of

the reference type,return_type is a record type indicating the types of the select list

that will eventually be returned by the cursor variable.

What should be the return type for a cursor variable. Can we use a scalar data type as

return type ?

The return type for a cursor must be a record type.It can be declared explicitly as a user-defined or

%ROWTYPE can be used. eg TYPE t_studentsref IS REF

CURSOR RETURN students%ROWTYPE

How you open and close a cursor variable.Why it is required ?

OPEN cursor variable FOR SELECT...Statement

CLOSE cursor variable In order to associate a cursor variable with a particular

SELECT statement OPEN syntax is used.In order to free the resources used

for the query CLOSE

statement is used.

How you were passing cursor variables in PL/SQL 2.2 ?

In PL/SQL 2.2 cursor variables cannot be declared in a package.This is because the storage

for a cursor variable has to be allocated using Pro*C or OCI with version 2.2,the only means of

passing a cursor variable to a PL/SQL block is via bind variable or a procedure parameter.

Can cursor variables be stored in PL/SQL tables.If yes how.If not why?

No, a cursor variable points a row which cannot be stored in a two-dimensional PL/SQL table.

Difference between procedure and function ?

Functions are named PL/SQL blocks that return a value and can be called with arguments

procedure a named block that can be called with parameter. A procedure all is a PL/SQL statement

by itself, while a Function call is called as part of an expression.

Page 17: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

What are different modes of parameters used in functions and procedures ?

IN, OUT, INOUT.

What is difference between a formal and an actual parameter ?

The variables declared in the procedure and which are passed, as arguments are called actual,

the parameters in the procedure declaration. Actual parameters contain the values that are passed

to a procedure and receive results. Formal parameters are the placeholders for the values of actual

parameters.

Can the default values be assigned to actual parameters ?

Yes

Can a function take OUT parameters. If not why ?

No. A function has to return a value, an OUT parameter cannot return a value.

What is syntax for dropping a procedure and a function ?

Drop Procedure procedure_name

Drop Function function_name

What are ORACLE PRECOMPILERS ?

Using ORACLE PRECOMPILERS ,SQL statements and PL/SQL blocks can be contained inside

3GL programs written in C,C++,COBOL,PASCAL, FORTRAN,PL/1 AND ADA.

The Precompilers are known as Pro*C,Pro*Cobol,...

This form of PL/SQL is known as embedded pl/sql,the language in which pl/sql is embedded is

known as the host language.

The prcompiler translates the embedded SQL and pl/sql ststements into calls to the precompiler

runtime library.The output must be compiled and linked with this library to creater an executable.

What is OCI. What are its uses ?

Oracle Call Interface is a method of accesing database from a 3GL program. Uses--No

precompiler is required,PL/SQL blocks are executed like other DML statements.

The OCI library provides

-functions to parse SQL statemets

-bind input variables

-bind output variables

-execute statements

-fetch the results

Difference between database triggers and form triggers ?

a) Data base trigger(DBT) fires when a DML operation is performed on a data base table.Form

trigger(FT) Fires when user presses a key or navigates between fields on the screen

b) Can be row level or statement level No distinction between row level and statement level.

c) Can manipulate data stored in Oracle tables via SQL Can manipulate data in Oracle tables as

well as variables in forms.

d) Can be fired from any session executing the triggering DML statements. Can be fired only

from the form that define the trigger.

e) Can cause other database triggers to fire.Can cause other database triggers to fire,but not other form triggers.

Page 18: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

What is an UTL_FILE.What are different procedures and functions associated

with it ?

UTL_FILE is a package that adds the ability to read and write to operating system files

Procedures associated with it are FCLOSE, FCLOSE_ALL and 5 procedures to output data to a

file PUT, PUT_LINE, NEW_LINE, PUTF, FFLUSH.PUT,

FFLUSH.PUT_LINE,FFLUSH.NEW_LINE. Functions associated with it are FOPEN, ISOPEN.

Can you use a commit statement within a database trigger ?

No

What is maximum buffer size that can be specified using the DBMS_OUTPUT.ENABLE

function?

1,000,000

What is index ?

INDEX is a general term for an ORACLE / SQL feature used primarily to speed execution an

impose UNIQUENESS upon certain data. INDEX provides a faster access method to one table’s

data than doing a full table scan.

There are several types of Indexes :

UNIQUE INDEX, COMPRESSED INDEX, CONCATENATED INDEX. An Index has an entry

for each value found in the table’s Indexed field(s) ( except those with a NULL value ) and

pointer(s) to the rows having that value.

What is Data Dictionary ?

The DATA DICTIONARY is a comprehensive set of tables and views owned by the DBA

users SYS and SYSTEM, which activates when ORACLE is initially installed, and is a cental

source of information for the ORACLE RDBMS itself and for all users of ORACLE. The tables

are automatically maintained by ORACLE, and holds a set of views and tables containing

information about the database objects, users, privileges, events, and use.

What is a package ?

A PACKAGE is a PL/SQL object that groups PL/SQL types, variables, SQL cursors,

exceptions,procedures, and functions.Each package has a specification and a body. The

specification shows the object you can access when you use the package. The body fully defines

all the objects and can contain additional objects used only for the internal workings. You can

change the body (for example, by adding procedures to the packages) without invalidating any

object that uses the package.

What is Schema ?

A SCHEMA is a collection of objects.

SCHEMA objects are logical structures that directly refer to the database’s data.

SCHEMA objects include structures such as tables, views, synonyms, sequences, indexes,

clusters, stored procedures and data links.

1. What is a View ? Why is it required to define a View ?

A View is a database object that is a logical representation of a table. It is derived from a

table but has no storage space of its own and often may be used in the same manner as a table.

Advantage: 1. Security 2. Complex query can be replaced.

2. Can we create a View without a table ?

Page 19: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

Yes, Using the FORCE option in the CREATE VIEW syntax.

Ex: CREATE FORCE VIEW view_name as SELECT column name, columnname..

FROM table_name;

3. What is the difference between a SYNONYM and a VIEW ?

A SYNONYM is a name assigned to a table or view that may thereafter be used to refer it.

If you access to another user’s table, you may create a synonym for it and refer to it by the

synonym alone, without entering the user’s name as a qualifier.

Difference: A View can be based on MULTIPLE Tables whereas a SYNONYM is based on a

single object only.

4. What is SNAPSHOT ? What is a SNAPSHOT LOG ?

A SNAPSHOT is a means of creating a local copy of remote data. A snapshot can be

used to replicate all or part of a single table, or to replicate the result of a query against multiple

tables. The refreshes of the replicated data can be done automatically by the database ( at time

intervals you specify ) or manually.Snapshot Log is the table associated with the Master Table of

the Snap shot.

5. What is a DATABASE trigger ? What is a DATABASE Procedure ?

A DATABASE TRIGGER is a stored procedure associated with a table that ORACLE7

automatically executes on one or more specified events (BEFORE or AFTER an

INSERT,UPDATE or DELETE) affecting the table. Triggers can execute for the table as a whole

or for each affected row in the table.

A PACKAGED PROCEDURE is a built-in PL/SQL procedure that is available in all

forms. Each packaged procedure executes a SQL*FORMS function, such as moving to a field or

executing a query.

8. What is a CURSOR ?

A work area in memory where ORACLE stores the current SQL statement. For a query ,

the area in memory also includes column headings and one row retrieved by the SELECT

statement.

10. Can we pass a PARAMETER to CURSOR ? What is SQL%ROWCOUNT ?

We can pass parameter to CURSOR. Eg: OPEN CUSOR(‘VASAN’).

SQL%ROWCOUNT is used to count the number of rows returned by an SQL DML statement. It

will return zero if the DML statement doesn’t return any row.

15. Can we use a funtion inside an INSERT statement ?

Yes. Eg: INSERT INTO EMP(COMM ) VALUES ( SAL*0.05 ) WHERE DEPTNO = 20;

16. What is TRUNCATE table ?

TRUNCATE table is a DDL command used to remove all the rows from the specified

table or cluster instantly. Eg: TRUNCATE TABLE table_name;

17. What is ROWID ? What are its components ?

ROWID is the logical address of a row, and it is unique within the database.The ROWID

is broken into three sections: left,middle,, and right (corresponding to 00001F20,000C, AND

0001, just shown). The numbering is in hexadecimal notation.

The left section is the block in the file, the middle is the row sequence number within the

block(numbering starts with 0, not 1), and the right is the file number within the database. Note

Page 20: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

that the file numbers are uniquewithin the whole database. The tablespace they are in is not

relevant to the ROWID.

ROWID can be selected, or used in a where clause, but cannot be changed by an insert,

update, or delete. However it can changeif the table it is in is exported and imported.

21. Name any ORACLE defined EXCEPTION ?

CURSOR_ALREADY_OPEN, NO_DATA_FOUND, INVALID_NUMBER.

22. Can we define our OWN EXCEPTION ? How to raise it ?

In the DECLARATION part define a variable of type exception. In the excecution part call

the exception using RAISE exception_name. In the exception part handle the exception using

WHEN exception_name.

23. What is a PRAGMA ?

It is a directive to the COMPILER, rather than a piece of executable code. Eventhough it

appears in the program, it is not executable. It gives instructions to the compiler.

24. Difference between CHAR and VARCHAR2 ?

CHAR(size) - It is a fixed length character data, size characters long. It is padded with

BLANKS ON RIGHT to the full length of size. DEFAULT - 1 bytes, MAXIMUM - 255 bytes.

VARCHAR2(size) - It is a varable length char string having a maximum of size bytes.

MAXIMUM - 2000 bytes.

25. What is a CURSOR FOR LOOP ?

The CURSOR FOR LOOP lets you implicitly OPEN a cursor, FETCH each row returned

by the query associated with the cursor and CLOSE the cursor when all rows have been processed.

26. What are the possible CONSTRAINTS defined on a TABLE ?

NOT NULL, UNIQUE KEY, PRIMARY KEY, FOREIGN KEY and CHECK constraints.

27. What is APPLICATION PARTITIONING ?

PL/SQL is the language used for both client-side Oracle forms applications and server-side

database triggers and stored procedures and there is a PL/SQl engine in both Oracle forms

Runform and the Oracle7 Server.

This means that you can take advantage of application patitioning to execute application

code on either the client or the server.

Application partitioning allows you to optimize performance and resource usage by storing

and executing procedures either locally or at the server, which makes the most sense for your

particular application and configuration.

28. Difference between a STORED PROCEDURE and a STORED FUNCTION ?

Unlike procedures, FUNCTIONS returns a VALUE to the caller. This value is returned

thro’ the RETURN command/keyword within the function.

Functions don’t use the IN, OUT | IN OUT arguments, which are available for

PROCEDURES.

29. How to RUN PROCEDURES from SQL PROMPT ?

Use EXECUTE Procedure_name command.

30. How to TRAP ERRORS in procedures ?

Page 21: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

Use SHOW_ERRORS. this will display all the errors associated with the most recently

created procedural object. This command will check the VIEW_ERRORS data dictionary for the

ERRORS associated with the most recent compilation attempt for that procedural object.

SHOW_ERRORS will display the LINE and COLUMN NO. for each error, as well as the

text of the error message.

DBMS_OUTPUT package allows you to use 3 debugging functions within your package. You

must set ‘SERVER OUTPUT ON’ before executing the procedure object you will be debugging.

PUT - Puts multiple o/p’s on same line.

PUT_LINE - Puts each o/p on a separate line.

NEW_LINE - Used with PUT; Signals the END of current o/p line.

38. What is the DIFFERENCE between PRE-QUERY and POST-QUERY ?

PRE-QUERY fires ONLY ONCE during EXECUTE-QUERY or COUNT-QUERY

processing, just before Oracle Forms constructs and issues the SELECT statement to identify rows

that match the query criteria.

POST-QUERY fires each time for records placed on the blocks list of records.

41. What is the DIFFERENCE between EXPLICIT CURSOR & IMPLICIT CURSOR ?

IMPLICIT CURSORS are automatically opened by issuing a SELECT statement. But the

EXPLICIT cursors are to be opened using OPEN, fetching is done using FETCH and closing

using CLOSE.

42. What is the difference between ROWID and ROWNUM ?

ROWID is the logical address of the row, whereas ROWNUM returns the sequence no. in

which the row was retrieved when first feched from a table.

43. What is the RESULT of the statement ?

SELECT EMPNO, NAME,SAL FROM EMP WHERE ROWNUM >2;

Result : 0, No rows will be selected.

44. How do you evaluate performance ?

Using SQL TRACE. It is an utility that can monitor and report on database performance

when one or more queries are run against the database.

It is used to gather statistics when running the query (i.e) reports on CPU time spent on the

query, the total no. of rows processed and statistics related to parsing and cache performance.

53. What is a DEAD LOCK ?

A DEAD lock is a rare situation in which two or more user processes of a database cannot

complete their tansactions.This occurs because each process is holding a resource that the other

process requires (such as a row in a table) in order to complete.

63. What does ‘GROUP BY’ statement do ?

GROUP BY statement causes a SELECT statement to produce ONE SUMMARY ROW

for all selected rows that have identical values in one or more specified column or expressions.

Each expe\ressionin the SELECT clause must be one of the following :

1] A CONSANT

2] A Function without parameters

3] A GROUP function like SUM , AVG.

4] Matched IDENTICALLY to a expression in the ‘GROUP BY’ clause.

Page 22: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

75. Difference between SQL and PL/SQL ?

SQL is the ANSI industry standard language, used to manipulate information in a

relational database.

PL/SQL is the procedural language extension to Oracle’s SQL language.

SQL PL/SQL

1. It is flexible, Powerful and easy to learn.

2. It is a non-procedural language. It

a] Processes set of records rather than

just one at a time and

b] Provides automatic navigation to the

data.

3. It provides commands for avariety of

tasks including :

a] Querying data

b] Creating,Updating and Replacing

objects and Inserting, Updating

and Deleting rows.

4] All RDBMS supports SQL

Thus one can transfer the skills gained

with SQL from one

RDBMS to another.

Programs written in SQL are portable,

they can often be moved from one database

to another with little modification.

1. PL/SQL block can contain any no. of

SQL statements combined with the

following :

a] Flow of control statements such as

IF..THEN, ELSE, EXIT and GOTO.

b] Repetition statements such as FOR ..

LOOP and WHILE .. LOOP.

c] Assignment statements such as X := Y +

Z

2. PL/SQL allows you to logically group a

set of statements and send them to the

RDBMS as a single block.

3. Procedural capabilities.

4. Improved performance.

5. Enhanced productivity

6. Portability

7. Integration with the RDBMS.

77. What is the purpose of OUTER JOIN ?

An OUTER JOIN returns all the rows returned by simple join as well as those rows from

one table that do not match any row from the other table. The symbol (+) represents the outer join.

78. Difference between EQUI JOIN and OUTER JOIN ?

EQUI JOIN returns rows from both the tables provided they both have the same

column_name in the where clause. The symbol (=) represents the EQUI JOIN.

For OUTER JOIN see previous answer.

79. Define NORMALIZATION ?

NORMALIZATION is the process of putting things right, making them normal. It is a

part of analysis necessary to understand a business, and build a useful application.

The normalization of data ensures

a] Minimization of duplication of data.

b] Providing flexibility to support different funtional requirements.

c] Enabling the model to be translated to database design.

STEPS INVOLVED IN NORMALIZATION

1] Ensure that all the ENTITIES are uniquely identified by a combination of attributes.

2] Remove repeated attributes or group of attributes, to place the entities in the first

normal form.

3] Remove attributes that are dependent on only part of the identifier.

4] Remove attributes that are dependent on attributes which are not part of the identifier.

Page 23: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

85. What is the Purpose of ERASE command ?

ERASE removes an indicated Global variable & releases the memory associated with it

What is LookUp table ?

When a foreign key exists in a table, the foreign key's table is sometimes referred to as a

lookup table. The DEPARTMENT table in our example is a lookup table for the EMPLOYEE

table. The value of an employee's department can be looked up in the DEPARTMENT table.

MULTIPLE CHOICE QUESTIONS

11. The purpose of defining an index is

(A) Enhance Sorting Performance (B) Enhance Searching Performance

(C) Achieve Normalization (D) All of the above

12. A transaction does not necessarily need to be

(A) Consistent (B) Repeatable (C) Atomic (D) Isolated

13. To group users based on common access permission one should use

(A) User Groups (B) Roles (C) Grants (D) None of the above

14. PL/SQL uses which of the following

(A) No Binding (B) Early Binding (C) Late Binding (D) Deferred Binding

15. Which of the constraint can be defined at the table level as well as at the column level

(A) Unique (B) Not Null (C) Check (D) All the above

16. To change the default date format in a SQLPLUS Session you have to

(A) Set the new format in the DATE_FORMAT key in the windows Registry.

(B) Alter session to set NLS_DATE-FORMAT.

(C) Change the Config.ora File for the date base.

(D) Change the User Profile USER-DATE-FORMAT.

17. Which of the following is not necessarily an advantages of using a package rather than

independent stored procedure in data base.

(A) Better performance. (B) Optimized memory usage.

(C) Simplified Security implementation. (D) Encapsulation.

18. Integrity constrains are not checked at the time of

(A) DCL Statements. (B) DML Statements.

(C) DDL Statements. (D) It is checked all the above cases.

19. Roll Back segment is not used in case of a

(A) DCL Statements. (B) DML Statements. (C) DDL Statements. (D) all of the above.

Page 24: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

QUERIES

Where do we use distinct keyword ?

Distinct is used to avoid duplicating records…………………

DELETE

FROM table_name A

WHERE rowid>(SELECT min(rowid) from table_name B where

B.table_no=A.table_no);

CREATE TABLE new_table AS SELECT DISTINCT * FROM old_table;

DROP old_table

RENAME new_table TO old_table

DELETE FROM table_name A

WHERE rowid NOT IN (SELECT MAX(ROWID) FROM table_name

GROUP BY column_name)

How you will avoid your query from using indexes ?

SELECT * FROM emp

Where emp_no+' '=12345;

i.e you have to concatenate the column name with

space within codes in the where condition.

SELECT /*+ FULL(a) */ ename, emp_no from emp

where emp_no=1234;

i.e using HINTS

Guidelines for developers working with Databases

• Should follow the Hungarian Style in naming the Database name (SQL server), Schema

name(Oracle), field/column name in the respective databases.

Example:

EmployeeName ------ Correct

EmpName, empname, emp_name ------ Incorrect

• If the Column/Table name exceeds more than 30 characters the developer can go for

abbreviated names, but it should be completely relevant to the work what the table is

doing.

Page 25: How to change UserID and Password in Oracle. why do we use ...4student.weebly.com/uploads/1/3/5/5/13552547/oracle.pdf · Oracle is an open system i.e. the database is accessing by

For Example: The ProjectSpecificPreferencesDetails Table can be named ProjSpecPrefDetails,

which is meaningful and also satisfies the field/column’s length.

• Avoid using UnderScores( _ ) while naming Columns and Tables.

• Should use the concepts of Stored Procedures (SQL Server), Procedures (Oracle),

Functions, Triggers where ever necessary in the database design Try to avoid unnecessary

connections in the database server in a loop. Using Procedures,

Functions and Triggers solves this problem. Another alternative is to get the whole data

into the client and try to solve the problem in the client level only, instead of interacting

with the server for several times in a loop.

• Should follow the Normalization concepts properly. Try to achieve the Third Normal Form

for the data base which is designed, it is considered to be more efficient.(Normal Forms are

discussed below)

• No table in the database should be independent. Every table should be related with one or

the other table.

• Should follow the concept of index in the database. Multiple indexing is advisable if there

is an assumption of storing huge data. Retrieval of data will be faster if indexes are used.