SlideShare a Scribd company logo
1 of 93
Oracle9i: An Overview
Dr R.Khanchana
Assistant Professor
Department of Computer Science
Sri Ramakrishna College of Arts and Science for Women
Personal Databases
• Personal database management systems
Data is collected and stored on personal computers which is small
and easily manageable. The data is generally used by the same
department of an organization and is accessed by a small group of
people.
 Microsoft Access and Visual fox Pro are usually stored on a users desktop computer
system or client computer.
 These database packages are developed primarily for single –user application.
Client/ Server database
• Client/ Server database management systems
– The data are stored on a server which are transmitter to the
client computers over the network.
• Servers resources
– servers hard –disk drive space, application programs on a
servers hard drive ,data stored on the servers drive, or
printers
Network
• Network - A network is an infrastructure of
hardware and software that enables computer
to communicate with each other
Personal Databases
A Personal database system in a multiuser environment
File server
(Database file)
Gets file requests from clients
Sends files to clients
Receive files back
Client computer #1
(DBMS, Client Applications)
Sends file request
Receive files
Adds Deletes Updates Data
Sends files back
Client Computer #2
(DBMS, Client Applications)
Sends file request
Receive files
Adds Deletes Updates Data
Sends files back
NETWORK
Demand on Client and Network
Load entire Db application to Memory
– Network environment with the personal DBMS, the
Client computer must load the entire database
application along with the client database application
in its memory.
– If the client requires a small piece of data form the
server large database, the server has to transmit the
entire database/ part of the database to the client over
the network.
Heavy Traffic
– The system response to various client request depends
on the speed of the network and the amount of traffic
over it.
Table Locking
• The personal database system assumes that no
two transaction will happen at the same time on
one table, which is known as optimistic locking.
• The tables are not locked by the database system.
• Personal database software does not lock tables
automatically.
Client Failure
• A client is performing record insertion, deletion
or updates, those records are locked by that client
and are not available to other clients.
• The transaction in progress at the time of failure
are lost.
• Repair Database
– If database can get corrupted needs to be repaired. To
repair database all users have to log off. It will takes
few minutes or few hours
– If the database is not reparable, data can be restored
from the last backup, but the transactions since the
backup are lost and have to be reentered.
Transaction Processing
• Personal databases, such as Microsoft Access, do
not have file-based transaction logging.
• Instead, transaction are logged in the client’s
memory.
• If the client fails in the middle of batch
transactions, some transactions are written to the
database and some are not.
• The transaction log is lost, because it is not stored
in a file.
• Eg: Money Transaction
CLIENT/SERVER DATABASE
CLIENT/SERVER DATABASE
• Client/databases
– Oracle, run the DBMS as a process and a server and run a
client database application on each client.
• The client application sends a request for data over the
network to the server.
• The server receives the client request, the DBMS
retrieves data from the database, performance the
required processing on the data, and sends only the
requested data(or query result) back to the client over
the network.
A Client/Server database system in a multiuser environment
Database server
(DBMS process)
Gets file requests from clients
Adds Deletes Updates, filters
data
Client computer #1
( Client Applications)
Sends file request
Receive results
Sends new data
Client computer #2
(Client Applications)
Sends data request
Receive results
Sends new data
NETWORK
Demand on Client and Network
• The Client computer does not run the the
entire DBMS, only the client application that
request data from the server.
• The client does not store any database on its
local drive; it requested data from the server.
• Data processing is performed on the server’s
side.
• The demand at the client’s end is minimal.
Table Locking
• In a Client/server system, such as Oracle,
when an agent reads a table to sell a seat for a
basketball game, for example, it is locked
totally or partly by the DBMS.
• The second agent cannot read the part of the
table with available seats.
• The DBMS takes care of the locking
automatically, and it involves no extra effort
on an application programmer's part.
Client Failure
• In case of a client failure, the client/server
database is not affected.
• The other clients are not affected either.
• Only the failed client’s transaction in progress
are lost. Is the server fails, a central
transaction log, a log of all current database
changes, allows the database Administrator
(DBA) or DBMS to complete or roll back
unfinished transactions.
Transaction Processing
• If a grouped transaction or batch transaction
fails in the middle, all transactions are rolled
back.
• The DBMS will enable the bank, for example,
to make sure that both account balances are
changed if the batch transaction goes through.
Quiz
• https://quizizz.com/admin/quiz/5f0eca6aa600
47001b9541f5
Feedback
• https://docs.google.com/forms/d/1byYkWTfp
19K6_02ToP582u8SJ99D0WLpZzUVhEecUcE/e
dit
Oracle 9i Introduction
• It is a client/server DBMS that is based on
Relational Data Model
• qualities, failure handling, recovery management,
administrative tool to manage user.
• It is widely used by corporations of all sizes to
develop mission-critical applications.
• It is also used as a teaching tool by educational
institution to teach object- relation database
technology, SQL, PL/SQL and interfacing with
oracle database.
Oracle Software Environments
• Stand-alone Environment
– Laptop / Desktop that is not on a network
• Client/ Sever Environment
– Two–tier Architecture
– Three–tier Architecture
Oracle 9i Tools
 SQL*plus- writing command–line SQL queries to work with database objects.
 PL/SQL: SQL for creating procedural.
 Developer suite: Developing database application.
Jdeveloper- Java development tool.
Designer – Business process and generate enterprise application.
Forms Developer- Internet and client/server based environment.
Oracle reports- A report generation tool.
 Enterprise manager: managing users and database.
Store manager – to create and manage “tablespaces”.
Instance manager- to,start,stop,or tune database.
Security manager – create and manage users,profiles and roles.
Warehouse manager- manage data warehousing applications.
Xml database manager-render traditional database as XML.
SQL worksheet – enter, edit and execute SQL*pluse code.
iSQL*plus- web-based environment to execute SQL*pluse code.
SQL *plus Environment
• SQL*plus provides the user
with the SQL > prompt.
 Accepts ad hoc entry of
statements at the command
line prompt.
 Accepts SQL statements from
files.
 Provides a line editor for
modifying SQL queries.
 Provides environment, editor,
format, execution.
 Format query results, and
displays reports on the screen
 Control environmental
settings.
 Access local and remote
database.
Query typed at SQL >Prompt
QUERY excedds one line SQL * plus
displays in the next line
Each query end by semicolon (;)
A query sent to server by using a
forward slash (/)
SQL (Structured Query Language)
• The standard query language for relational
database is SQL.
• It is standardized and accepted by ANSI and
ISO.
• SQL is a 4th generation ,high-level, non
procedural language.
• SQL is standardized and its syntax is the same
across most RDBMS packages.
• Oracle’s SQL is different from the ANSI SQL.
Types of SQL Statements
• Data retrieval - retrieves data from the database.
– SELECT
• Data manipulation language – Changes the existing rows.
– INSERT, UPDATE, DELETE
• Data Definition Language (DDL) – removes a table’s
structure.
– CREATE, DROP, ALTER, RENAME, TRUNCATE
• Transaction Control Language (TCL) – manages and
changes the logical transaction.
– COMMIT, SAVEPOINT, ROLLBACK
• Data Control Language (DCL)– gives and removes rights
to Oracle objects.
– GRANT, REVOKE
LOGGING INTO SQL*PLUS
• In windows environment,
click
– Start/ Programs / Oracle –
Orahome92/ Application
Development / SQL*Plus.
• Enter
– User name, Password and
Host string as provided by
your database administrator.
LOGGING INTO SQL*PLUS
Command Line Environment
• In a command–line
environment such as DOS.
– Type Sqlplus [user
name[/password[@host/
database]]].
Command Line Environment
REVIEW
SQL*PLUS COMMANDS
• The command word are in both letters and
user-supplied filenames and extensions are in
lower case.
• SQL*plus commands are underlined.
• Optional parameters are enclosed within a pair
of brackets ([]).
• The filename in the field-related commands
requires entire file path.
ORACLE ERRORS AND ONLINE
HELP
• Write and execute SQL statements and queries at
the SQL*plus prompt.
• Oracle places an Asterisk(*) at the location of the
error and also displays an error code.
• Some queries take up a few lines.
• Errors are easy to find.
• Check for common mistakes like misspelled key
words.
• Each Oracle product has its own specific help
file.
ALTERNATIVE TEXT EDITOR
• The SQL*plus editor is a line editor similar to EDLIN in
MS-DOS .
• Its not fun working with line editor.
• The user does not have control over the screen.
• Its use an alternate text editor such as Notepad or any
other text editor in Windows to type your SQL queries.
• The query typed in a full –screen text editor has to be
saved in a file with an sql extension or copied to the
clipboard.
• The EDIT (or ED) command can be used to invoke an
alternate text editor from the SQL * plus command
prompt.
SQL*PLUS WORKSHEET
• The SQL*plus worksheet is another environment available
with Oracle’s Enterprise Manager.
• The SQL*plus worksheet enables you to enter, edit, and
execute SQL*plus code.
• Its also run client-side script.
The following from the window START button:
START | [All] programs | Oracle–OraHome92 |
Application Development | SQLplus Worksheet
• An enterprise Manager login screen is the Displayed.
SQL*PLUS WORKSHEET
• The sql plus system variable SQLPROMPT is disabled by
default.
• SQLNUMBER is set to OFF by default.
• PAGESIZE is set to its maximum by default.
• TAB is set to OFF by default.
• It there are any prompt characters “&” in a script, SQL*plus
treats it as a “define” prompt.
• The HOST command is not supported in SQL *plus
Worksheet.
• EDITOR is disabled by default.
• Remote execution is not supported.
• Remote load and save of script files is not supported.
iSQL*plus
• The third environment is web based and is called
iSQL *plus .
• To access it through web browser, enter a URL as
follow:
http://machinename.domainname:port /isqlplus
• In this URL, machinename is your machine ,but
port number is not required in all version
http://nshah-monroe/isqlplus
• The domain name is not used, because
iSQL*plus is located in the local machine .
QUIZ
• https://quizizz.com/admin/quiz/5f114fd32c2f
3b001bdb5b0c
Feedback
• https://docs.google.com/forms/d/1OHByCo28
HvjPTgIbX72gkmtEN6Qfr4_H7CkXHeHYy58/ed
it
My E-Book
• https://www.amazon.in/SQL-Commands-
Khanchana-Satyavathy-Deepa-
ebook/dp/B072218158/ref=sr_1_1?dchild=1&
keywords=dr+R+Khanchana&qid=1595133967
&s=books&sr=1-1
ORACLE TABLES
DATA DEFINITION LANGUAGES
• In Oracle9i database tables are objects stored
under a user’s account in an allocated table space
on the Oracle Server disk.
• In the classroom environment ,each student is a
user with a unique login/username.
• To create tables using SQL statements at the
SQL*plus prompt.
• Its also learn to use alternate editors from easier
editing of erroneous statement.
NAMING RULES AND CONVENTIONS
• A Table is an object that can store data in Oracle
Database.
– Specify the table name, the name of the each column, the
data type of each column, and the size of each column
• Oracle provides the different constraints to specify a
primary and the composite key for the table
• To define the foreign key in a table that references a
primary in another table , to set data validation rules
for each column should have unique values only.
NAMING RULES AND CONVENTIONS
• The table and the column names can be up to 30 characters long
• It is possible to have a table name that is only one character long.
• In Naming tables and the column letters(A-Z, a-z),numbers(0,9) and
the special characters-$(dollar sign),-(underscore),and (pound or
number sign)are allowed.
• The table or the column name should begin with the letter
• The name are not case sensitive, Oracle stores all name in
uppercase.
• Space and hyphens are not allowed in a table or column name
Naming - Examples
Vaild Names Invaild Names
STUDENT
MAJOR_CODE
X
PROJECT 2000
STUDENT#REG#TABLE
STUDENT_COURSE_REGISTERATION_TABLE
(more than 30 character long)
MAJOR CODE(spaces not allowed)
CREATE (reversed word not allowed)
PROJECT***2000(special character * not
allowed)
#STUDENT (must start with a letter)
Data Types
Data Types
• Table is created with each column is assigned as the data type.
• Data type that specifies the type of data that will be stored in the
column.
• By providing the data type for the column , the wrong kinds of
data are prevented from being stored in the column.
For Example:
Smith cannot be stored in the NUMBER data type.
Job title such as Manager cannot be stored in the NUMBER data type
Data Types
• Varchar2
• Char
• Number
• Date
Varchar2
• VARCHAR2 type is a character data type to store variable
length alphanumeric data in column
• VARCHAR is a synonymous with VARCHAR2 but it could
be a separate data type with different semantics in a future.
• Users are advised to use varchar only. A maximum size must
be specified for this type.
• Default and the minimum size is the one characters.
• Maximum allowable size is 4000 characters in Oracle9i.
Maximum size was 2000 in previous version
• If longer than the specific values is entered error is generated.
In Oracle9i, VARCHAR2 data type can also take CHAR or
BYTE parameters
Example: NAME, ADDRESS
Char
• The CHAR type is a character data type to store fixed
length alphanumeric data in a column.
• The default and the minimum size is the one characters.
• Maximum allowable size is 2000 characters. 255
characters in previous version
• If the value is smaller than the specified size is entered ,
trailing space is added to make its length equal to the
specified length. If it is longer , the error occurs
• The CHAR type is approximate for the fixed length
values.
Example: PHONE_ NO and PINCODE
Number
• The Number data type is used to store negative, positive,
integer, fixed-decimal and floating point numbers.
• The number data type can use to any column that is going to
be employed in mathematic calculation for
• When a number type is used for a column its precision and
scale can be specified.
• Precision is the total number of significant digits in the
number, both left and right of the decimal point
• Scale is the total number of digits to the right of the decimal
point.
• Precision range 1 to 38 , Scale range -84 to 127, An integer is a
whole number without decimal part
• Example: SALARY,COMMISSION or PRICE.
Date
• The DATE data type is used for storing date and time values.
• The range of allowable date is between January 1,4712 B.C
and December 31,999 A.D
• The day month,century,hour,minute,and second are stored
in the Date-TYPE COUMN
• No need to specify size for date data type
• DD-MON-YYYY format also works as default in Oracle9i
• Default time format is HH:MM:SS A.M, representing hours,
minutes and seconds in a 12 hour time format.
• In a table it is not advisable to use column like AGE, because
age not only change for all entities but also changes at
different times.
Quiz
• https://quizizz.com/admin/quiz/5f140a3c219
aa5001b718920
Advanced data types for our
information
LONG: The LONG type is used for variable length character data up to 2
gigabytes.
NCHAR: The NCHAR type is similar to char but uses 2 byte binary encoding
for each characters.
CLOB :The character large object data type is used to store single byte
character data up to 4 gigabytes
BLOB: The Binary large object data type is used to store binary data up to 4
gigabytes.
NCLOB: The character large object type uses 2 byte characters code
BFILE: The binary file type stores references to a binary file that is external to
the database and is maintained by the operating system file system
RAW(size) or LONG _RAW: These are used for raw binary data
ROWID: For unique row address in hexadecimal format
CONSTRAINTS
• Constraints enforce rules on table
• An oracle table can be created with the column names,
datatype and column size
• The constraints are used in oracle to implement integrity rules
of a relational database and to implement data integrity at the
individual column level.
• When a row record is inserted, updated or deleted from the
table, constraints must satisfy for the operation to succeed.
Types of constraints
• There are two type of constraints:
 Integrity constraints:
Define both the primary key and the foreign
key with the table and primary key it
reference.
Value constraints:
Define if NULL values are disallowed, if
UNIQUE values are required , and if only
certain set of value are allowed in a column.
Naming a constraints
• Oracle identifies constraints with an internal or user-created
name.
• A user cannot create constraints in two different tables with
the same name.
The general convention used in naming constraints is given
below
Syntax <table name>_<column name>_<constraints type>
Constraints & its Abbrevations
Constraints Abbreviation
PRIMARY KEY pk
FOREIGN KEY fk
UNIQUE uk
CHECK ck or cc
NOT NULL nn
Naming a constraint
A constraints can be created at the same time the table is
created, or it can be added to the table afterward.
There are two levels where a constraint is defined:
Table
Level
Column
Level
Defining constraints
Column level:
• A column level constraints a single column and is defined along with the definition of column
• Any constraints can be defined at the column level except FOREIGN KEY and composite primary key constraints
Syntax Column data type[CONSTRAINT constraint _name]constraint_type,
• Each column may have zero, one or more constraints defined at the column level.
Example :
CREATE TABLE mytable(name CHAR(10) NOT NULL,
id INTEGER REFERENCES idtable(id),
age INTEGER CHECK (age > 0));
Table level:
• A Table level constraints reference one or more column and is defined seperately from the definitions of the column
• All constraints can be defined at the table level except for the NOT NULL constraint
Syntax: [CONSTRAINT constraint _name]constraint_type(column,…),
The table level constraints are normally declared after all column definitions.
CREATE TABLE yourtable(firstname CHAR(20) NOT NULL,
lastname CHAR(20) NOT NULL,
UNIQUE(firstname, lastname));
The PRIMARY KEY Constraints
• The primary key constraint is an known also the
entity integrity constraint.
• It creates a primary key for the table.
• A table can have only one primary key constraint.
• A column or combination of columns used as a
primary key cannot have a null value and its can
only have unique values.
Deptid NUMBER(2) CONSTRAINT dept
_deptid_pk PRIMARY KEY.
The FOREIGN KEY Constraint
• The foreign key constraint is also known as
the reference integrity constraint.
• If uses a column or column as a foreign key,
and it establishes a relationship with the
primary key of the same or another tables.
CONSTRAINT student_facultyid_fk FOREIGN
KEY(facultyid)REFERENCES faculty(facultyid)
The NOT NULL constraints
• The NOT NULL constraints ensures that the
column has a value is not a null value.
• A space or a numeric zero is not a null
value.
• There is no need to use the not null
constraint for the primary key column,
because it automatically gets the not null
constraint.
Name VARCHAR(15) CONSTRAINT
faculty_name_nn NOT NULL
The UNIQUE Constraint
• The UNIQUE constraint requires that every value in
a column or set of column be unique.
• If it is applied to a single column, the column has
unique values only.
• Primary key will not accept NULL values
whereas Unique key can accept one NULL value.
• If it is applied to a set of columns, the group of
column has a unique value together.
• The unique constraint allows null value unless NOT
NULL is also applied to the column.
CONSTRAINT dept_nmae_uk UNIQUE(DeptName)
The CHECK Constraint
• The CHECK constraint defines a condition that
every row must satisfy.
• There can be more than one CHECK constraint
on a column, and the CHECK constraint can be
define at the column as well as the table level.
Deptid NUMBER (2) CONSTRAINT dept_deptid_cc
CHECK((Deptid >= 10)and (Deptid <= 99))
The NOT NULL CHECK constraint
• A NOT NULL constraint can be declared
as a CHECK constraint.
• It can be defined at column or table level.
• Name VARCHAR2(15) CONSTRAINT
faculty_name_ck_CHECK (Name IS NOT NULL)
The DEFAULT Value(It’s NOT A
Constraint)
• The default value ensure that a particular column
will always have a value when a new row is
inserted.
• The default value gets over written if a user
enters another value.
• The default value is used if a null value is
inserted.
State CHAR(2) DEFAULT ’NJ’
The DEFAULT Value -Example
Quiz
• https://quizizz.com/admin/quiz/5f140af909d4
1c001bdf01cf
Feedback
• https://docs.google.com/forms/d/1OHByCo28
HvjPTgIbX72gkmtEN6Qfr4_H7CkXHeHYy58/ed
it
ORACLE
• TABLE CREATION
• DDL COMMANDS
• Tutorials
https://www.tutorialspoint.com/sql/sql-truncate-
table.htm
• Online SQL Editors & its Execution
• https://livesql.oracle.com/
• https://www.jdoodle.com/execute-sql-online/
• https://www.tutorialspoint.com/oracle_terminal
_online.php
CREATE DATABASE
• The SQL CREATE
DATABASE statement is used
to create a new SQL database.
• Syntax
– CREATE DATABASE
DatabaseName;
• Example
DROP DATABASE
• The SQL DROP
DATABASE statement is used
to drop an existing database
in SQL schema.
• Syntax
– DROP DATABASE
DatabaseName;
• Example
Creating on Oracle table
• Create Table Query is used for Table creation
• A table is created as soon as the CREATE
statement is executed by the ORACLE server.
• Create TABLE tablename (column1 datatype,
column2 datatype);
• A user creates an Oracle table in the SQL*plus
environment/
• An Oracle table is created from the SQL > prompt
in the SQL*plus environment.
• A data definition language SQL statement,
CREATE TABLE is used for table creation.
Create Table -Syntax
CREATE TABLE [schema.] tablename
(column 1 datatype[CONSTRAINT constraint_name]constraint_type,
Column 2 datatype[CONSTRAINT constraint_name]constraint_type,
[CONSTRAINT constraint_name] constraint_type(column,…),…);
• Schema is Optional
• Table name is the name of the table given by user
• Column is the name of a single column
• Data type is the column’s data type and size
• Constraint name is the name of constraint provided by the user
• Constraint type is the integrity or value constraint
Error in a Query
• C/CONSRAINT/CONSTRAINT to change the correct
spelling.
• To load on erroneous statement in Notepad and modify
it.
1. At the SQL > prompt, type ED in invoke Notepad.
2. Required correction to the script.
3. A:CREATE.Notepad adds the extensions.txt to the
file name
4. Notepad to go back to the SQL*plus environment.
5. Run the saved statement with @ or the RUN
command.
STORAGE Clause in CREATE TABLE
STORAGE Clause in CREATE TABLE
This clause is used to allocate initial disk space for the table at the time
of creation with the INITIAL parameter and also to allocate additional
space with the NEXT parameter in case the table runs out of allocated
initial space.
Create table sample (id NUMBER(3), Name VARCHAR2(25))
TABLESPACE CIS_DATA
STORAGE (INITIAL 1M NEXT 100K)
PCTFREE 20;
The STORAGE clause allocates 1 MB initially on tablespace
CIS_DATA & 100KB as additional space on the same tablespace.
The PCTFREE(percentage-free) clause is used to allow for future
increment in row size.
Create Table -Example
Displaying table information
• User create a table or many tables in his or her
database.
• Oracle tracks them all using its own Data Dictionary.
• User to view that information from Oracles Data
Dictionary tables.
1. Viewing a user’s table names
2. Viewing a table’s structure
3. Viewing constraint information
4. Viewing tablespace information
5. COMMENT on Tables and Columns
DISPLAYING TABLE INFORMATION
• Viewing a User’s Table Names
SELECT TABLE_NAME FROM USER_TABLES;
Example
SELECT * FROM USER_TABLES;
Assignment –Create Table
Create 10 different tables with minimum 5 attributes and different constraints
–Employee
–Customer
–Sales
–Student
–Department
–Employee
–Invoice
–Item
–Project
–Faculty
DISPLAYING TABLE INFORMATION
• Viewing a Table’s Structure
DESCRIBE Student;
DISPLAYING TABLE INFORMATION
• Viewing Constraint Information
Constraint Type – C – Not Null & Check
P – Primary key
R – Foreign Key
ORACLE TABLE - EXAMPLE
Altering an existing table
Modifications allowed without any restrictions:
• Adding a new column to the table
• Deleting a foreign key constraint from a table
• Renaming columns
• Renaming constraints
Altering an existing table
Modifications allowed with restrictions
• Adding a foreign key is allowed
• Adding a primary key is allowed
• Adding a unique constraint is possible
• Adding a check constraint is possible
• Adding a default value is possible
• Checking a column’s name
• Checking a constraint’s name
• Removing a column
Altering an existing table
Modifications not allowed include
• Changing a column’s name (oracle 8i and
earlier)
• Changing a constraint’s name (oracle 8i and
earlier)
• Removing a column (oracle 8i and earlier)
Adding a New Column to an Existing Table
• Syntax
– ALTER TABLE tablename
ADD Columnname datatype;
Modifying an Existing Column
Syntax:
• ALTER TABLE tablename
MODIFY columnname newdatatype;
Dropping a table
• The existing table structure has so many flaws
it is advisable to drop it and recreate it.
• A table is dropped, all data and the table
structure are permanently deleted.
• All associated indexes are removed.
• DROP TABLE table name[CASCADE CONSTRAINTS];
Renaming the table
• Rename a table provided are the owner of the table.
• RENAME oldtablename TO newtablename;.
• Oracle will display a “table renamed”. Message statement is
executed.
Truncating the table
• A table is removing all records/rows from the table.
• The structure of the table stays intact.
• The table with the DELETE TABLE privilege to
truncate the table
• The SQL language is a DELETE statement the can be
used to remove one or more rows from a table, and its
reversible as long as it is not committed.
• Syntax :TRUNCATE TABLE tablename;
Table types
Permanent
tables
Temporary
tables
Index organized
tables
External tables
• Permanent tables are used for
storing the data.
• Temporary tables are used during
a session or a transaction tables.
• Index organized tables are used
for tables with primary key values
that are looked up frequently.
• External tables are stored
”outside” the database with
CREATE TABLE.
Spooling
• Handy feature.
• A user can redirect all statements, quires,
command and results to a file for later review or
print out.
• The method creates a text file of all actions and
their results.
• To start spooling go to the file menu in the
SQL*plus window.
• Click on spool and spool file in subsequent
menus.
• To stop spooling at any point, use the same menu
to click on spool.
Spool Options
Method 1
Method 2
Error codes
• It able to get it by clicking on START-ORACLE-ORACLE
HOME92.
• The error help the screen is displayed, click on the index tab.
• The type error code received from oracle in the space provided.
• The typing click on the display button to get on explanation of
the error code is straight forward.
Assignments
• Exercise 1
– Write the correct SQL statement to create a new database
called testDB
• Exercise 2
– Write the correct SQL statement to delete a database
named testDB
• Exercise 3
– Write the correct SQL statement to create a new table
called Persons
• Exercise 4
– Write the correct SQL statement to delete a table
called Persons.
Assignments - Answers
• Exercise 1
– Write the correct SQL statement to create a new database
called testDB
• CREATE DATABASE testDB;
• Exercise 2
– Write the correct SQL statement to delete a database named testDB
• DROP DATABASE testDB;
• Exercise 3
– Write the correct SQL statement to create a new table called Persons
• CREATE TABLE Persons (PersonID int, LastName varchar(255), FirstName
varchar(255), Address varchar(255), City varchar(255) );
• Exercise 4
– Write the correct SQL statement to delete a table called Persons.
• DROP TABLE Persons;

More Related Content

What's hot (20)

Introduction to sql
Introduction to sqlIntroduction to sql
Introduction to sql
 
SQL
SQLSQL
SQL
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
Triggers
TriggersTriggers
Triggers
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts
 
DML Commands
DML CommandsDML Commands
DML Commands
 
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbms
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Sdi & mdi
Sdi & mdiSdi & mdi
Sdi & mdi
 
SQL Constraints
SQL ConstraintsSQL Constraints
SQL Constraints
 
Integrity constraints in dbms
Integrity constraints in dbmsIntegrity constraints in dbms
Integrity constraints in dbms
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
4. plsql
4. plsql4. plsql
4. plsql
 
Dbms classification according to data models
Dbms classification according to data modelsDbms classification according to data models
Dbms classification according to data models
 
ER MODEL
ER MODELER MODEL
ER MODEL
 

Similar to Unit 2 oracle9i

Beginning Of DBMS (data base)
Beginning Of DBMS (data base)Beginning Of DBMS (data base)
Beginning Of DBMS (data base)Surya Swaroop
 
UNIT3 DBMS.pptx operation nd management of data base
UNIT3 DBMS.pptx operation nd management of data baseUNIT3 DBMS.pptx operation nd management of data base
UNIT3 DBMS.pptx operation nd management of data baseshindhe1098cv
 
Case Study For Replication For PCMS
Case Study For Replication For PCMSCase Study For Replication For PCMS
Case Study For Replication For PCMSShahzad
 
Odbc and data access objects
Odbc and data access objectsOdbc and data access objects
Odbc and data access objectsSangeetha Sg
 
SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1sqlserver.co.il
 
Database Administration & Management - 01
Database Administration & Management - 01Database Administration & Management - 01
Database Administration & Management - 01FaisalMashood
 
DBAM-01.pdf
DBAM-01.pdfDBAM-01.pdf
DBAM-01.pdfhania80
 
Exchange Server 2013 : les mĂŠcanismes de haute disponibilitĂŠ et la redondance...
Exchange Server 2013 : les mĂŠcanismes de haute disponibilitĂŠ et la redondance...Exchange Server 2013 : les mĂŠcanismes de haute disponibilitĂŠ et la redondance...
Exchange Server 2013 : les mĂŠcanismes de haute disponibilitĂŠ et la redondance...Microsoft Technet France
 
Breaking data
Breaking dataBreaking data
Breaking dataTerry Bunio
 
Planning For Catastrophe with IBM WAS and IBM BPM
Planning For Catastrophe with IBM WAS and IBM BPMPlanning For Catastrophe with IBM WAS and IBM BPM
Planning For Catastrophe with IBM WAS and IBM BPMWASdev Community
 
Database failover from client perspective
Database failover from client perspectiveDatabase failover from client perspective
Database failover from client perspectivePriit Piipuu
 
Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502kaziul Islam Bulbul
 
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018 Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018 Antonios Chatzipavlis
 
collab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdfcollab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdfElboulmaniMohamed
 
SQL Server ASYNC_NETWORK_IO Wait Type Explained
SQL Server ASYNC_NETWORK_IO Wait Type ExplainedSQL Server ASYNC_NETWORK_IO Wait Type Explained
SQL Server ASYNC_NETWORK_IO Wait Type ExplainedConfio Software
 
SQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should KnowSQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should KnowDean Richards
 
SQL PPT.pptx
SQL PPT.pptxSQL PPT.pptx
SQL PPT.pptxKulbir4
 
Azure data platform overview
Azure data platform overviewAzure data platform overview
Azure data platform overviewAlessandro Melchiori
 

Similar to Unit 2 oracle9i (20)

Database Management System - 2a
Database Management System - 2aDatabase Management System - 2a
Database Management System - 2a
 
Beginning Of DBMS (data base)
Beginning Of DBMS (data base)Beginning Of DBMS (data base)
Beginning Of DBMS (data base)
 
UNIT3 DBMS.pptx operation nd management of data base
UNIT3 DBMS.pptx operation nd management of data baseUNIT3 DBMS.pptx operation nd management of data base
UNIT3 DBMS.pptx operation nd management of data base
 
Case Study For Replication For PCMS
Case Study For Replication For PCMSCase Study For Replication For PCMS
Case Study For Replication For PCMS
 
Odbc and data access objects
Odbc and data access objectsOdbc and data access objects
Odbc and data access objects
 
SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1
 
Database Administration & Management - 01
Database Administration & Management - 01Database Administration & Management - 01
Database Administration & Management - 01
 
DBAM-01.pdf
DBAM-01.pdfDBAM-01.pdf
DBAM-01.pdf
 
Exchange Server 2013 : les mĂŠcanismes de haute disponibilitĂŠ et la redondance...
Exchange Server 2013 : les mĂŠcanismes de haute disponibilitĂŠ et la redondance...Exchange Server 2013 : les mĂŠcanismes de haute disponibilitĂŠ et la redondance...
Exchange Server 2013 : les mĂŠcanismes de haute disponibilitĂŠ et la redondance...
 
Breaking data
Breaking dataBreaking data
Breaking data
 
Planning For Catastrophe with IBM WAS and IBM BPM
Planning For Catastrophe with IBM WAS and IBM BPMPlanning For Catastrophe with IBM WAS and IBM BPM
Planning For Catastrophe with IBM WAS and IBM BPM
 
Database failover from client perspective
Database failover from client perspectiveDatabase failover from client perspective
Database failover from client perspective
 
Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502
 
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018 Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
 
collab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdfcollab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdf
 
SQL Server ASYNC_NETWORK_IO Wait Type Explained
SQL Server ASYNC_NETWORK_IO Wait Type ExplainedSQL Server ASYNC_NETWORK_IO Wait Type Explained
SQL Server ASYNC_NETWORK_IO Wait Type Explained
 
SQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should KnowSQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should Know
 
SQL PPT.pptx
SQL PPT.pptxSQL PPT.pptx
SQL PPT.pptx
 
Xml
XmlXml
Xml
 
Azure data platform overview
Azure data platform overviewAzure data platform overview
Azure data platform overview
 

More from DrkhanchanaR

Unit I-Data Structures_Intoduction.pptx
Unit I-Data Structures_Intoduction.pptxUnit I-Data Structures_Intoduction.pptx
Unit I-Data Structures_Intoduction.pptxDrkhanchanaR
 
Unit 5 composite datatypes
Unit 5  composite datatypesUnit 5  composite datatypes
Unit 5 composite datatypesDrkhanchanaR
 
Unit 5 internal sorting &amp; files
Unit 5  internal sorting &amp; filesUnit 5  internal sorting &amp; files
Unit 5 internal sorting &amp; filesDrkhanchanaR
 
Unit 4 external sorting
Unit 4   external sortingUnit 4   external sorting
Unit 4 external sortingDrkhanchanaR
 
Unit 3 graph chapter6
Unit 3  graph chapter6Unit 3  graph chapter6
Unit 3 graph chapter6DrkhanchanaR
 
Unit 3 Tree chapter 5
Unit 3  Tree chapter 5Unit 3  Tree chapter 5
Unit 3 Tree chapter 5DrkhanchanaR
 
Unit 2 linked list
Unit 2   linked listUnit 2   linked list
Unit 2 linked listDrkhanchanaR
 
Unit I-Data structures stack & Queue
Unit I-Data structures stack & QueueUnit I-Data structures stack & Queue
Unit I-Data structures stack & QueueDrkhanchanaR
 
Unit I - Evaluation of expression
Unit I - Evaluation of expressionUnit I - Evaluation of expression
Unit I - Evaluation of expressionDrkhanchanaR
 
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...DrkhanchanaR
 

More from DrkhanchanaR (10)

Unit I-Data Structures_Intoduction.pptx
Unit I-Data Structures_Intoduction.pptxUnit I-Data Structures_Intoduction.pptx
Unit I-Data Structures_Intoduction.pptx
 
Unit 5 composite datatypes
Unit 5  composite datatypesUnit 5  composite datatypes
Unit 5 composite datatypes
 
Unit 5 internal sorting &amp; files
Unit 5  internal sorting &amp; filesUnit 5  internal sorting &amp; files
Unit 5 internal sorting &amp; files
 
Unit 4 external sorting
Unit 4   external sortingUnit 4   external sorting
Unit 4 external sorting
 
Unit 3 graph chapter6
Unit 3  graph chapter6Unit 3  graph chapter6
Unit 3 graph chapter6
 
Unit 3 Tree chapter 5
Unit 3  Tree chapter 5Unit 3  Tree chapter 5
Unit 3 Tree chapter 5
 
Unit 2 linked list
Unit 2   linked listUnit 2   linked list
Unit 2 linked list
 
Unit I-Data structures stack & Queue
Unit I-Data structures stack & QueueUnit I-Data structures stack & Queue
Unit I-Data structures stack & Queue
 
Unit I - Evaluation of expression
Unit I - Evaluation of expressionUnit I - Evaluation of expression
Unit I - Evaluation of expression
 
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
 

Recently uploaded

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Recently uploaded (20)

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

Unit 2 oracle9i

  • 1. Oracle9i: An Overview Dr R.Khanchana Assistant Professor Department of Computer Science Sri Ramakrishna College of Arts and Science for Women
  • 2. Personal Databases • Personal database management systems Data is collected and stored on personal computers which is small and easily manageable. The data is generally used by the same department of an organization and is accessed by a small group of people.  Microsoft Access and Visual fox Pro are usually stored on a users desktop computer system or client computer.  These database packages are developed primarily for single –user application.
  • 3. Client/ Server database • Client/ Server database management systems – The data are stored on a server which are transmitter to the client computers over the network. • Servers resources – servers hard –disk drive space, application programs on a servers hard drive ,data stored on the servers drive, or printers
  • 4. Network • Network - A network is an infrastructure of hardware and software that enables computer to communicate with each other
  • 6. A Personal database system in a multiuser environment File server (Database file) Gets file requests from clients Sends files to clients Receive files back Client computer #1 (DBMS, Client Applications) Sends file request Receive files Adds Deletes Updates Data Sends files back Client Computer #2 (DBMS, Client Applications) Sends file request Receive files Adds Deletes Updates Data Sends files back NETWORK
  • 7. Demand on Client and Network Load entire Db application to Memory – Network environment with the personal DBMS, the Client computer must load the entire database application along with the client database application in its memory. – If the client requires a small piece of data form the server large database, the server has to transmit the entire database/ part of the database to the client over the network. Heavy Traffic – The system response to various client request depends on the speed of the network and the amount of traffic over it.
  • 8. Table Locking • The personal database system assumes that no two transaction will happen at the same time on one table, which is known as optimistic locking. • The tables are not locked by the database system. • Personal database software does not lock tables automatically.
  • 9. Client Failure • A client is performing record insertion, deletion or updates, those records are locked by that client and are not available to other clients. • The transaction in progress at the time of failure are lost. • Repair Database – If database can get corrupted needs to be repaired. To repair database all users have to log off. It will takes few minutes or few hours – If the database is not reparable, data can be restored from the last backup, but the transactions since the backup are lost and have to be reentered.
  • 10. Transaction Processing • Personal databases, such as Microsoft Access, do not have file-based transaction logging. • Instead, transaction are logged in the client’s memory. • If the client fails in the middle of batch transactions, some transactions are written to the database and some are not. • The transaction log is lost, because it is not stored in a file. • Eg: Money Transaction
  • 12. CLIENT/SERVER DATABASE • Client/databases – Oracle, run the DBMS as a process and a server and run a client database application on each client. • The client application sends a request for data over the network to the server. • The server receives the client request, the DBMS retrieves data from the database, performance the required processing on the data, and sends only the requested data(or query result) back to the client over the network.
  • 13. A Client/Server database system in a multiuser environment Database server (DBMS process) Gets file requests from clients Adds Deletes Updates, filters data Client computer #1 ( Client Applications) Sends file request Receive results Sends new data Client computer #2 (Client Applications) Sends data request Receive results Sends new data NETWORK
  • 14. Demand on Client and Network • The Client computer does not run the the entire DBMS, only the client application that request data from the server. • The client does not store any database on its local drive; it requested data from the server. • Data processing is performed on the server’s side. • The demand at the client’s end is minimal.
  • 15. Table Locking • In a Client/server system, such as Oracle, when an agent reads a table to sell a seat for a basketball game, for example, it is locked totally or partly by the DBMS. • The second agent cannot read the part of the table with available seats. • The DBMS takes care of the locking automatically, and it involves no extra effort on an application programmer's part.
  • 16. Client Failure • In case of a client failure, the client/server database is not affected. • The other clients are not affected either. • Only the failed client’s transaction in progress are lost. Is the server fails, a central transaction log, a log of all current database changes, allows the database Administrator (DBA) or DBMS to complete or roll back unfinished transactions.
  • 17. Transaction Processing • If a grouped transaction or batch transaction fails in the middle, all transactions are rolled back. • The DBMS will enable the bank, for example, to make sure that both account balances are changed if the batch transaction goes through.
  • 20. Oracle 9i Introduction • It is a client/server DBMS that is based on Relational Data Model • qualities, failure handling, recovery management, administrative tool to manage user. • It is widely used by corporations of all sizes to develop mission-critical applications. • It is also used as a teaching tool by educational institution to teach object- relation database technology, SQL, PL/SQL and interfacing with oracle database.
  • 21. Oracle Software Environments • Stand-alone Environment – Laptop / Desktop that is not on a network • Client/ Sever Environment – Two–tier Architecture – Three–tier Architecture
  • 22. Oracle 9i Tools  SQL*plus- writing command–line SQL queries to work with database objects.  PL/SQL: SQL for creating procedural.  Developer suite: Developing database application. Jdeveloper- Java development tool. Designer – Business process and generate enterprise application. Forms Developer- Internet and client/server based environment. Oracle reports- A report generation tool.  Enterprise manager: managing users and database. Store manager – to create and manage “tablespaces”. Instance manager- to,start,stop,or tune database. Security manager – create and manage users,profiles and roles. Warehouse manager- manage data warehousing applications. Xml database manager-render traditional database as XML. SQL worksheet – enter, edit and execute SQL*pluse code. iSQL*plus- web-based environment to execute SQL*pluse code.
  • 23. SQL *plus Environment • SQL*plus provides the user with the SQL > prompt.  Accepts ad hoc entry of statements at the command line prompt.  Accepts SQL statements from files.  Provides a line editor for modifying SQL queries.  Provides environment, editor, format, execution.  Format query results, and displays reports on the screen  Control environmental settings.  Access local and remote database. Query typed at SQL >Prompt QUERY excedds one line SQL * plus displays in the next line Each query end by semicolon (;) A query sent to server by using a forward slash (/)
  • 24. SQL (Structured Query Language) • The standard query language for relational database is SQL. • It is standardized and accepted by ANSI and ISO. • SQL is a 4th generation ,high-level, non procedural language. • SQL is standardized and its syntax is the same across most RDBMS packages. • Oracle’s SQL is different from the ANSI SQL.
  • 25. Types of SQL Statements • Data retrieval - retrieves data from the database. – SELECT • Data manipulation language – Changes the existing rows. – INSERT, UPDATE, DELETE • Data Definition Language (DDL) – removes a table’s structure. – CREATE, DROP, ALTER, RENAME, TRUNCATE • Transaction Control Language (TCL) – manages and changes the logical transaction. – COMMIT, SAVEPOINT, ROLLBACK • Data Control Language (DCL)– gives and removes rights to Oracle objects. – GRANT, REVOKE
  • 26. LOGGING INTO SQL*PLUS • In windows environment, click – Start/ Programs / Oracle – Orahome92/ Application Development / SQL*Plus. • Enter – User name, Password and Host string as provided by your database administrator.
  • 27. LOGGING INTO SQL*PLUS Command Line Environment • In a command–line environment such as DOS. – Type Sqlplus [user name[/password[@host/ database]]]. Command Line Environment
  • 29. SQL*PLUS COMMANDS • The command word are in both letters and user-supplied filenames and extensions are in lower case. • SQL*plus commands are underlined. • Optional parameters are enclosed within a pair of brackets ([]). • The filename in the field-related commands requires entire file path.
  • 30. ORACLE ERRORS AND ONLINE HELP • Write and execute SQL statements and queries at the SQL*plus prompt. • Oracle places an Asterisk(*) at the location of the error and also displays an error code. • Some queries take up a few lines. • Errors are easy to find. • Check for common mistakes like misspelled key words. • Each Oracle product has its own specific help file.
  • 31. ALTERNATIVE TEXT EDITOR • The SQL*plus editor is a line editor similar to EDLIN in MS-DOS . • Its not fun working with line editor. • The user does not have control over the screen. • Its use an alternate text editor such as Notepad or any other text editor in Windows to type your SQL queries. • The query typed in a full –screen text editor has to be saved in a file with an sql extension or copied to the clipboard. • The EDIT (or ED) command can be used to invoke an alternate text editor from the SQL * plus command prompt.
  • 32. SQL*PLUS WORKSHEET • The SQL*plus worksheet is another environment available with Oracle’s Enterprise Manager. • The SQL*plus worksheet enables you to enter, edit, and execute SQL*plus code. • Its also run client-side script. The following from the window START button: START | [All] programs | Oracle–OraHome92 | Application Development | SQLplus Worksheet • An enterprise Manager login screen is the Displayed.
  • 33. SQL*PLUS WORKSHEET • The sql plus system variable SQLPROMPT is disabled by default. • SQLNUMBER is set to OFF by default. • PAGESIZE is set to its maximum by default. • TAB is set to OFF by default. • It there are any prompt characters “&” in a script, SQL*plus treats it as a “define” prompt. • The HOST command is not supported in SQL *plus Worksheet. • EDITOR is disabled by default. • Remote execution is not supported. • Remote load and save of script files is not supported.
  • 34. iSQL*plus • The third environment is web based and is called iSQL *plus . • To access it through web browser, enter a URL as follow: http://machinename.domainname:port /isqlplus • In this URL, machinename is your machine ,but port number is not required in all version http://nshah-monroe/isqlplus • The domain name is not used, because iSQL*plus is located in the local machine .
  • 38. ORACLE TABLES DATA DEFINITION LANGUAGES • In Oracle9i database tables are objects stored under a user’s account in an allocated table space on the Oracle Server disk. • In the classroom environment ,each student is a user with a unique login/username. • To create tables using SQL statements at the SQL*plus prompt. • Its also learn to use alternate editors from easier editing of erroneous statement.
  • 39. NAMING RULES AND CONVENTIONS • A Table is an object that can store data in Oracle Database. – Specify the table name, the name of the each column, the data type of each column, and the size of each column • Oracle provides the different constraints to specify a primary and the composite key for the table • To define the foreign key in a table that references a primary in another table , to set data validation rules for each column should have unique values only.
  • 40. NAMING RULES AND CONVENTIONS • The table and the column names can be up to 30 characters long • It is possible to have a table name that is only one character long. • In Naming tables and the column letters(A-Z, a-z),numbers(0,9) and the special characters-$(dollar sign),-(underscore),and (pound or number sign)are allowed. • The table or the column name should begin with the letter • The name are not case sensitive, Oracle stores all name in uppercase. • Space and hyphens are not allowed in a table or column name
  • 41. Naming - Examples Vaild Names Invaild Names STUDENT MAJOR_CODE X PROJECT 2000 STUDENT#REG#TABLE STUDENT_COURSE_REGISTERATION_TABLE (more than 30 character long) MAJOR CODE(spaces not allowed) CREATE (reversed word not allowed) PROJECT***2000(special character * not allowed) #STUDENT (must start with a letter)
  • 42. Data Types Data Types • Table is created with each column is assigned as the data type. • Data type that specifies the type of data that will be stored in the column. • By providing the data type for the column , the wrong kinds of data are prevented from being stored in the column. For Example: Smith cannot be stored in the NUMBER data type. Job title such as Manager cannot be stored in the NUMBER data type
  • 43. Data Types • Varchar2 • Char • Number • Date
  • 44. Varchar2 • VARCHAR2 type is a character data type to store variable length alphanumeric data in column • VARCHAR is a synonymous with VARCHAR2 but it could be a separate data type with different semantics in a future. • Users are advised to use varchar only. A maximum size must be specified for this type. • Default and the minimum size is the one characters. • Maximum allowable size is 4000 characters in Oracle9i. Maximum size was 2000 in previous version • If longer than the specific values is entered error is generated. In Oracle9i, VARCHAR2 data type can also take CHAR or BYTE parameters Example: NAME, ADDRESS
  • 45. Char • The CHAR type is a character data type to store fixed length alphanumeric data in a column. • The default and the minimum size is the one characters. • Maximum allowable size is 2000 characters. 255 characters in previous version • If the value is smaller than the specified size is entered , trailing space is added to make its length equal to the specified length. If it is longer , the error occurs • The CHAR type is approximate for the fixed length values. Example: PHONE_ NO and PINCODE
  • 46. Number • The Number data type is used to store negative, positive, integer, fixed-decimal and floating point numbers. • The number data type can use to any column that is going to be employed in mathematic calculation for • When a number type is used for a column its precision and scale can be specified. • Precision is the total number of significant digits in the number, both left and right of the decimal point • Scale is the total number of digits to the right of the decimal point. • Precision range 1 to 38 , Scale range -84 to 127, An integer is a whole number without decimal part • Example: SALARY,COMMISSION or PRICE.
  • 47. Date • The DATE data type is used for storing date and time values. • The range of allowable date is between January 1,4712 B.C and December 31,999 A.D • The day month,century,hour,minute,and second are stored in the Date-TYPE COUMN • No need to specify size for date data type • DD-MON-YYYY format also works as default in Oracle9i • Default time format is HH:MM:SS A.M, representing hours, minutes and seconds in a 12 hour time format. • In a table it is not advisable to use column like AGE, because age not only change for all entities but also changes at different times.
  • 49. Advanced data types for our information LONG: The LONG type is used for variable length character data up to 2 gigabytes. NCHAR: The NCHAR type is similar to char but uses 2 byte binary encoding for each characters. CLOB :The character large object data type is used to store single byte character data up to 4 gigabytes BLOB: The Binary large object data type is used to store binary data up to 4 gigabytes. NCLOB: The character large object type uses 2 byte characters code BFILE: The binary file type stores references to a binary file that is external to the database and is maintained by the operating system file system RAW(size) or LONG _RAW: These are used for raw binary data ROWID: For unique row address in hexadecimal format
  • 50. CONSTRAINTS • Constraints enforce rules on table • An oracle table can be created with the column names, datatype and column size • The constraints are used in oracle to implement integrity rules of a relational database and to implement data integrity at the individual column level. • When a row record is inserted, updated or deleted from the table, constraints must satisfy for the operation to succeed.
  • 51. Types of constraints • There are two type of constraints:  Integrity constraints: Define both the primary key and the foreign key with the table and primary key it reference. Value constraints: Define if NULL values are disallowed, if UNIQUE values are required , and if only certain set of value are allowed in a column.
  • 52. Naming a constraints • Oracle identifies constraints with an internal or user-created name. • A user cannot create constraints in two different tables with the same name. The general convention used in naming constraints is given below Syntax <table name>_<column name>_<constraints type>
  • 53. Constraints & its Abbrevations Constraints Abbreviation PRIMARY KEY pk FOREIGN KEY fk UNIQUE uk CHECK ck or cc NOT NULL nn
  • 54. Naming a constraint A constraints can be created at the same time the table is created, or it can be added to the table afterward. There are two levels where a constraint is defined: Table Level Column Level
  • 55. Defining constraints Column level: • A column level constraints a single column and is defined along with the definition of column • Any constraints can be defined at the column level except FOREIGN KEY and composite primary key constraints Syntax Column data type[CONSTRAINT constraint _name]constraint_type, • Each column may have zero, one or more constraints defined at the column level. Example : CREATE TABLE mytable(name CHAR(10) NOT NULL, id INTEGER REFERENCES idtable(id), age INTEGER CHECK (age > 0)); Table level: • A Table level constraints reference one or more column and is defined seperately from the definitions of the column • All constraints can be defined at the table level except for the NOT NULL constraint Syntax: [CONSTRAINT constraint _name]constraint_type(column,…), The table level constraints are normally declared after all column definitions. CREATE TABLE yourtable(firstname CHAR(20) NOT NULL, lastname CHAR(20) NOT NULL, UNIQUE(firstname, lastname));
  • 56. The PRIMARY KEY Constraints • The primary key constraint is an known also the entity integrity constraint. • It creates a primary key for the table. • A table can have only one primary key constraint. • A column or combination of columns used as a primary key cannot have a null value and its can only have unique values. Deptid NUMBER(2) CONSTRAINT dept _deptid_pk PRIMARY KEY.
  • 57. The FOREIGN KEY Constraint • The foreign key constraint is also known as the reference integrity constraint. • If uses a column or column as a foreign key, and it establishes a relationship with the primary key of the same or another tables. CONSTRAINT student_facultyid_fk FOREIGN KEY(facultyid)REFERENCES faculty(facultyid)
  • 58. The NOT NULL constraints • The NOT NULL constraints ensures that the column has a value is not a null value. • A space or a numeric zero is not a null value. • There is no need to use the not null constraint for the primary key column, because it automatically gets the not null constraint. Name VARCHAR(15) CONSTRAINT faculty_name_nn NOT NULL
  • 59. The UNIQUE Constraint • The UNIQUE constraint requires that every value in a column or set of column be unique. • If it is applied to a single column, the column has unique values only. • Primary key will not accept NULL values whereas Unique key can accept one NULL value. • If it is applied to a set of columns, the group of column has a unique value together. • The unique constraint allows null value unless NOT NULL is also applied to the column. CONSTRAINT dept_nmae_uk UNIQUE(DeptName)
  • 60. The CHECK Constraint • The CHECK constraint defines a condition that every row must satisfy. • There can be more than one CHECK constraint on a column, and the CHECK constraint can be define at the column as well as the table level. Deptid NUMBER (2) CONSTRAINT dept_deptid_cc CHECK((Deptid >= 10)and (Deptid <= 99))
  • 61. The NOT NULL CHECK constraint • A NOT NULL constraint can be declared as a CHECK constraint. • It can be defined at column or table level. • Name VARCHAR2(15) CONSTRAINT faculty_name_ck_CHECK (Name IS NOT NULL)
  • 62. The DEFAULT Value(It’s NOT A Constraint) • The default value ensure that a particular column will always have a value when a new row is inserted. • The default value gets over written if a user enters another value. • The default value is used if a null value is inserted. State CHAR(2) DEFAULT ’NJ’
  • 63. The DEFAULT Value -Example
  • 66. ORACLE • TABLE CREATION • DDL COMMANDS • Tutorials https://www.tutorialspoint.com/sql/sql-truncate- table.htm • Online SQL Editors & its Execution • https://livesql.oracle.com/ • https://www.jdoodle.com/execute-sql-online/ • https://www.tutorialspoint.com/oracle_terminal _online.php
  • 67. CREATE DATABASE • The SQL CREATE DATABASE statement is used to create a new SQL database. • Syntax – CREATE DATABASE DatabaseName; • Example
  • 68. DROP DATABASE • The SQL DROP DATABASE statement is used to drop an existing database in SQL schema. • Syntax – DROP DATABASE DatabaseName; • Example
  • 69. Creating on Oracle table • Create Table Query is used for Table creation • A table is created as soon as the CREATE statement is executed by the ORACLE server. • Create TABLE tablename (column1 datatype, column2 datatype); • A user creates an Oracle table in the SQL*plus environment/ • An Oracle table is created from the SQL > prompt in the SQL*plus environment. • A data definition language SQL statement, CREATE TABLE is used for table creation.
  • 70. Create Table -Syntax CREATE TABLE [schema.] tablename (column 1 datatype[CONSTRAINT constraint_name]constraint_type, Column 2 datatype[CONSTRAINT constraint_name]constraint_type, [CONSTRAINT constraint_name] constraint_type(column,…),…); • Schema is Optional • Table name is the name of the table given by user • Column is the name of a single column • Data type is the column’s data type and size • Constraint name is the name of constraint provided by the user • Constraint type is the integrity or value constraint
  • 71. Error in a Query • C/CONSRAINT/CONSTRAINT to change the correct spelling. • To load on erroneous statement in Notepad and modify it. 1. At the SQL > prompt, type ED in invoke Notepad. 2. Required correction to the script. 3. A:CREATE.Notepad adds the extensions.txt to the file name 4. Notepad to go back to the SQL*plus environment. 5. Run the saved statement with @ or the RUN command.
  • 72. STORAGE Clause in CREATE TABLE STORAGE Clause in CREATE TABLE This clause is used to allocate initial disk space for the table at the time of creation with the INITIAL parameter and also to allocate additional space with the NEXT parameter in case the table runs out of allocated initial space. Create table sample (id NUMBER(3), Name VARCHAR2(25)) TABLESPACE CIS_DATA STORAGE (INITIAL 1M NEXT 100K) PCTFREE 20; The STORAGE clause allocates 1 MB initially on tablespace CIS_DATA & 100KB as additional space on the same tablespace. The PCTFREE(percentage-free) clause is used to allow for future increment in row size.
  • 74. Displaying table information • User create a table or many tables in his or her database. • Oracle tracks them all using its own Data Dictionary. • User to view that information from Oracles Data Dictionary tables. 1. Viewing a user’s table names 2. Viewing a table’s structure 3. Viewing constraint information 4. Viewing tablespace information 5. COMMENT on Tables and Columns
  • 75. DISPLAYING TABLE INFORMATION • Viewing a User’s Table Names SELECT TABLE_NAME FROM USER_TABLES; Example SELECT * FROM USER_TABLES;
  • 76. Assignment –Create Table Create 10 different tables with minimum 5 attributes and different constraints –Employee –Customer –Sales –Student –Department –Employee –Invoice –Item –Project –Faculty
  • 77. DISPLAYING TABLE INFORMATION • Viewing a Table’s Structure DESCRIBE Student;
  • 78. DISPLAYING TABLE INFORMATION • Viewing Constraint Information Constraint Type – C – Not Null & Check P – Primary key R – Foreign Key
  • 79. ORACLE TABLE - EXAMPLE
  • 80. Altering an existing table Modifications allowed without any restrictions: • Adding a new column to the table • Deleting a foreign key constraint from a table • Renaming columns • Renaming constraints
  • 81. Altering an existing table Modifications allowed with restrictions • Adding a foreign key is allowed • Adding a primary key is allowed • Adding a unique constraint is possible • Adding a check constraint is possible • Adding a default value is possible • Checking a column’s name • Checking a constraint’s name • Removing a column
  • 82. Altering an existing table Modifications not allowed include • Changing a column’s name (oracle 8i and earlier) • Changing a constraint’s name (oracle 8i and earlier) • Removing a column (oracle 8i and earlier)
  • 83. Adding a New Column to an Existing Table • Syntax – ALTER TABLE tablename ADD Columnname datatype;
  • 84. Modifying an Existing Column Syntax: • ALTER TABLE tablename MODIFY columnname newdatatype;
  • 85. Dropping a table • The existing table structure has so many flaws it is advisable to drop it and recreate it. • A table is dropped, all data and the table structure are permanently deleted. • All associated indexes are removed. • DROP TABLE table name[CASCADE CONSTRAINTS];
  • 86. Renaming the table • Rename a table provided are the owner of the table. • RENAME oldtablename TO newtablename;. • Oracle will display a “table renamed”. Message statement is executed.
  • 87. Truncating the table • A table is removing all records/rows from the table. • The structure of the table stays intact. • The table with the DELETE TABLE privilege to truncate the table • The SQL language is a DELETE statement the can be used to remove one or more rows from a table, and its reversible as long as it is not committed. • Syntax :TRUNCATE TABLE tablename;
  • 88. Table types Permanent tables Temporary tables Index organized tables External tables • Permanent tables are used for storing the data. • Temporary tables are used during a session or a transaction tables. • Index organized tables are used for tables with primary key values that are looked up frequently. • External tables are stored ”outside” the database with CREATE TABLE.
  • 89. Spooling • Handy feature. • A user can redirect all statements, quires, command and results to a file for later review or print out. • The method creates a text file of all actions and their results. • To start spooling go to the file menu in the SQL*plus window. • Click on spool and spool file in subsequent menus. • To stop spooling at any point, use the same menu to click on spool.
  • 91. Error codes • It able to get it by clicking on START-ORACLE-ORACLE HOME92. • The error help the screen is displayed, click on the index tab. • The type error code received from oracle in the space provided. • The typing click on the display button to get on explanation of the error code is straight forward.
  • 92. Assignments • Exercise 1 – Write the correct SQL statement to create a new database called testDB • Exercise 2 – Write the correct SQL statement to delete a database named testDB • Exercise 3 – Write the correct SQL statement to create a new table called Persons • Exercise 4 – Write the correct SQL statement to delete a table called Persons.
  • 93. Assignments - Answers • Exercise 1 – Write the correct SQL statement to create a new database called testDB • CREATE DATABASE testDB; • Exercise 2 – Write the correct SQL statement to delete a database named testDB • DROP DATABASE testDB; • Exercise 3 – Write the correct SQL statement to create a new table called Persons • CREATE TABLE Persons (PersonID int, LastName varchar(255), FirstName varchar(255), Address varchar(255), City varchar(255) ); • Exercise 4 – Write the correct SQL statement to delete a table called Persons. • DROP TABLE Persons;