Lesson 1 - Introduction To Database Management System-Merged
Lesson 1 - Introduction To Database Management System-Merged
Oracle Database
Welcome to the 1st module of this course Database
Management System 1! For this lesson, we will introduce to
you the type of database system and its components.
_____________________________________________________________________________________
2
MODULE OF INSTRUCTION
describe what was done by the large computers in the
late 1940's until 1980's. The process of data
processing before is still being done by most large
organization. Example large volumes of raw
transaction data fed into programs that update a master
file, with fixed format reports written to paper.
2. The term Data Management Systems refers to an
expansion of data processing where the raw data that
fed into programs that update a master file, with fixed
format reports written to paper. is now fed into the
system from a variety of sources, including but not
limited to ATMs, EFT, and direct customer entry
through the Internet. The master file concept has been
largely displaced by database management systems,
and static reporting replaced or augmented by ad-hoc
reporting and direct inquiry, including downloading of
data by customers.
Characteristics of Database
1. Concurrent Access – is one of the characteristic of a
database system that allows several users to access the
_____________________________________________________________________________________
4
MODULE OF INSTRUCTION
protection of the database from unauthorized access
and changes.
5. Transactions - A transaction is a group of actions
which are done within a database to bring it from one
consistent state to a new consistent state. A transaction
is atomic which means that it cannot be divided up
any further. Within a transaction, all or none of the
actions need to be carried out.
6. Data Persistence - Data persistence means that in a
database management system all data is maintained as
long as it is not deleted explicitly in the database. The
life span of data needs to be determined directly or
indirectly be the user and must not be dependent on
system features which means a database administrator
may identify data that must be deleted or retained.
Disadvantages of a DBMS
1. Danger of a Overkill: For small and simple
applications or for single users a database system is
often not advisable.
2. Complexity: Having database system creates
additional complexity and requirements into the
_____________________________________________________________________________________
6
MODULE OF INSTRUCTION
company and or organization. Managing the operation
of a database management system with several users
and databases is quite costly and demanding.
3. Qualified Personnel: The professional operation of a
database system requires fully trained staff. Without a
qualified database administrator nothing will work for
long as no one will able to maintain and manage the
data store in the database.
4. Costs: having a database management system means
new costs are generated for the system itself but also
for additional hardware and the more complex
handling of the system.
5. Lower Efficiency: A database system is a multi-use
software or also known as generic software which is
often less efficient than specialized software which is
produced and optimized exactly for one problem.
Data Models
The underlying the structure of a database is the data model: it
is a collection of conceptual tools for describing data,
relationships, semantics, and integrity constraints.
Relational Model
The relational model uses a collection of tables to represent
both data and the relationships among those data a table in
relational model is also know an Entity. Each table or entity
has multiple columns or also known as an attribute which is
used to uniquely identify once table or entity to the other, and
each column has a unique name. The data is arranged in a
relation which is visually represented in a two dimensional
table meaning it is a relationship or connections of two or
more table. In the database, the data is inserted into the table
in the form of tuples or also known as values per row. The
_____________________________________________________________________________________
8
MODULE OF INSTRUCTION
relational model is implemented in database where a relation
is represented by a table, a tuple is represented by a row, an
attribute is represented by a column of the table, attribute
name is the name of the column such as ‘identifier’, ‘name’,
‘city’ etc., and attribute value contains the value for column in
the row.
Lesson Summary:
In this lesson, you should have learned the following.
Database
Database Management System
ER Model
Advantage and Disadvantage if database
Terms to Remember!
Application programs - are said to exhibit physical
data independence if they do not depend on the
physical schema.
Data-known facts that can be recorded and that have
implicit meaning.
Data integrity- is a byword for the quality and the
Textbook:
_____________________________________________________________________________________
10
MODULE OF INSTRUCTION
• Oracle Press (2010). Applied Oracle Security
References:
References • Pratt, Philip J. (2010). Database management systems
• Rob, Peter & Coronel, Carlo (2009). Database
Management Systems
• Schwalbe, Kathy (2011). Management of Information
Technology Projects
• Wheeler, Evan (2011). Security Risk Management :
Building an Information Security Risk Management
Program from the Ground Up
Supplementary Video
https://www.youtube.com/watch?v=1057YmExS-I
https://www.youtube.com/watch?v=kTVLO9F1QoY
https://www.youtube.com/watch?v=0uWA4zps-3k
Suggested Reading
• SQL Tutorial. In ws3schools, Retrieved from
http://www.w3schools.com/sql/default.asp
• Database management system. In Encyclopedia
Britannica, Retrieved from
http://www.britannica.com/EBchecked/topic/152201/d
atabase-management-system-DBMS.
• SQL. In Encyclopedia Britannica, Retrieved from
http://www.britannica.com/EBchecked/topic/569684/
SQL
_____________________________________________________________________________________
12
MODULE OF INSTRUCTION
Oracle Database
Welcome to the second module of this course Database
Management System 1! For this lesson, we will features and
usage of Oracle 11 express edition.
_____________________________________________________________________________________
2
MODULE OF INSTRUCTION
Tuning facility.
_____________________________________________________________________________________
4
MODULE OF INSTRUCTION
• A relational database is a collection of relations or a
connection of two-dimensional tables controlled by
the Oracle server.
SELECT
INSERT
UPDATE
DELETE
MERGE
CREATE
ALTER
DROP
RENAME
TRUNCATE
COMMENT
GRANT
REVOKE
4. Transaction control
COMMIT
ROLLBACK
SAVEPOINT
Lesson Summary:
In this lesson, you should have learned the following.
_____________________________________________________________________________________
6
MODULE OF INSTRUCTION
• Focus area of Oracle;
• Features; and
Terms to Remember!
• In 1970 the relational model was proposed by Dr.
E.F Codd and has been the basis for Relational
Database Management System.
• A relational database is a collection of relations or a
connection of two-dimensional tables controlled by
the Oracle server.
Textbook:
• Oracle Press (2010). Applied Oracle Security
References:
• Pratt, Philip J. (2010). Database management systems
• Rob, Peter & Coronel, Carlo (2009). Database
Management Systems
• Schwalbe, Kathy (2011). Management of Information
Technology Projects
• Wheeler, Evan (2011). Security Risk Management :
Building an Information Security Risk Management
Program from the Ground Up
References
Suggested Reading
• SQL Tutorial. In ws3schools, Retrieved from
http://www.w3schools.com/sql/default.asp
_____________________________________________________________________________________
8
MODULE OF INSTRUCTION
Welcome to the second module of this course. For this lesson, we will
discuss the task of Database Administrator, System requirement and
Installation procedure.
System Requirements
1. Memory requirements:
2
MODULE OF INSTRUCTION
3. Operating system
– Groups:
– oinstall
– dba
Optional groups (if doing separation of duty across multiple users):
– oper
– asmdba
– asmoper
– asmadmin
• Software owner, usually oracle
Requirements:
Installation Guide:
Step 1:
Step 2:
4
MODULE OF INSTRUCTION
Step 3:
Step 3:
Step 4:
Step 5:
Once verified the downloading the Oracle will start
Step 6:
6
MODULE OF INSTRUCTION
Step 7:
8
MODULE OF INSTRUCTION
Click Finish
10
MODULE OF INSTRUCTION
Note:
1. After clicking the finish button, locate the Oracle 11g
Express edition Folder found on the start menu of your
Operating system.
2. Then click the folder, click the PL/SQL Command Line.
3. When the CMD is open try to log-in using the username
and password set during installation.
4. Type in Connect then click enter
5. Then type the password: oracle (note typing the password
is hidden on the screen)
You must have the CONNECTED message. This means you
successfully log-in in Oracle using the PL/SQL command line.
Lesson Summary:
Before preceding with the next Chapters the student should
finished the following:
Create Oracle Account – www.oracle.com
Successfully Install Oracle Database 11g Express
Edition
Able to establish as user Connection at isqlplus using:
CONNECT
USERNAME: SYSTEM (Global Connection to Oracle)
PASSWORD: oracle (password inputted by the student during
installation)
Glossary
NLS_LANG: Optional environment variable that controls
language, territory, and client character set settings
References
Textbook:
Oracle Database 11g 2nd Edition K Gopalakrishnan (
2012)
References:
Carlos, Peter (2009). Database Systems
Connoly, Thomas & Begg, Carolyn (2010). Database
Systems : A practical approach to design,
implementation and management
Sciore, Edward (2009). Database Design and
Implementation
Bulusu, Lakshman (2008). Oracle PL/SQL : Expert
Techniques for Developers and Database
Administrators
Loshin, David (2008). Master Data Management
https://docs.oracle.com/cd/B19306_01/server.102/b14220/intro.htm
http://ugweb.cs.ualberta.ca/~c391/manual/chapt1.html
http://www.oracle-dba-online.com/introduction_to_oracle.htm
12
MODULE OF INSTRUCTION
Supplementary Video
https://www.youtube.com/watch?v=2deZysmz9rE&index=1&list=PLg
Xga1uh_X7dkEmttwzU7ulLa_abCq0N4
https://www.youtube.com/watch?v=B1EO24v2ico
https://www.youtube.com/watch?v=2deZysmz9rE
Database Objects:
A database objects is composed of the following:
Table Structure:
Tables can be created at any time, even if the users are
using the database at the same time while creating a new
table.
There is no need to specify the size of a table. The size is
ultimately defined by the amount of space allocated to
the database as a whole. As a database administrator, it is
important to estimate and know how much space a table
will use over time. Sometimes it depends on the data type
size and the amount of data stored in the table.
_____________________________________________________________________________________
2
MODULE OF INSTRUCTION
owned by the same Oracle server user. Meaning using
oracle reserved word like for example, table, view
database is not allowed, as well table name that has been
created by the other users.
Names must not be an Oracle server–reserved word.
Data type
1. VARCHAR- Variable-length character data
2. CHAR - Fixed-length character data
3. NUMBER - Variable-length numeric data
4. DATE - Date and time values
5. LONG - Variable-length character data (up to 2 GB
6. CLOB - Character data (up to 4 GB)
7. RAW and LONG RAW - Raw binary data
8. BLOB - Binary data (up to 4 GB)
9. BFILE - Binary data stored in an external file (up to
4 GB)
10. ROWID - A base-64 number system representing the
unique address of a row in its table
_____________________________________________________________________________________
4
MODULE OF INSTRUCTION
After the table has been created, by any chance that a user
might need to change the table structure for any of the
following reasons:
• You omitted a column.
• Your column definition or its name needs to be
changed.
• You need to remove columns.
• You want to put the table into the read-only mode
ALTER to ADD
Syntax:
ALTER TABLE tbl_name
ADD column_name datatype(size);
Example:
ALTER TABLE STUDENTS
ADD ADDRESS VARCHAR(15);
Use again DESC command to confirm that the
ADDRESS column is added in the column. From 5
columns it is now compose of 6 columns because of
the ALTER statement. Note the since the table is alter
form 5 to 6 column this only means that when a user
will insert or add a new values to this table, user must
provide now a data for the column ADDRESS.
Example of Insert:
_____________________________________________________________________________________
6
MODULE OF INSTRUCTION
INSERT INTO STUDENTS VALUES
(400,'ALMAZAN','MARY','BSIM','2','PASIG'
)
Text in underline is the values for the column
ADDRESS.
Notice that when a user try to view the whole
values of STUDENTS table the address of the
students who are insert before the user altered the
table are set to NULL.
ALTER to MODIFY
Syntax:
ALTER TABLE tbl_name
MODIFY column_name [new]datatype[new](size);
Supposed that a user wanted to add additional value for
the STUDENTS table but it so happen that the values
trying to insert in column lastname is too large. See
figure below:
Example:
ALTER TABLE STUDENTS
MODIFY LASTNAME VARCHAR(20);
_____________________________________________________________________________________
8
MODULE OF INSTRUCTION
ALTER to DROP
Syntax:
ALTER TABLE tbl_name
DROP COLUMN column_name;
Supposed that the column address is no longer used and
to save space you may use the ALTER to DROP
statement.
Example:
ALTER TABLE STUDENTS
DROP COLUMN ADDRESS;
To view and confirm that the column ADDRESS has
been deleted you may use the DESC command.
table:
Example:
TRUNCATE statement
To delete the values in the STUDENTS but
leaving it structure you may use the TRUNCATE
statement.
Syntax:
TRUNCATE TABLE tbl_name;
Example:
TRUNCATE TABLE STUDYANTE;
_____________________________________________________________________________________
10
MODULE OF INSTRUCTION
table is still intact.
Dropping a Table
All records in the table will be deleted as well as
it structure when you drop table has been issued,
A rollback statement will also help retrieve the
record after the DROP statement is issued if
PURGE statement has been applied.
Syntax
DROP TABLE table
In the syntax, table is the name of the table.
Guidelines
• All the data is deleted from the table.
• Any views and synonyms remain, but are invalid.
• Any pending transactions are committed.
• Only the creator of the table or a user with the DROP
ANY TABLE privilege can remove a table.
• Example:
DROP TABLE STUDENTS;
Using this will delete permanently the
STUDYANTE table as shown below.
Lesson Summary:
In this lesson you should have learned how to:
Create new table by using the CREATE table
statement.
Add, modify or drop exiting column using the
ALTER statement.
Change the name of the table using the RENAME
statement.
Delete the table using the DROP statement
Remove all rows in the table using the
TRUNCATE statement.
Terms to Remember!
BFILE - Binary data stored in an external file (up to 4 GB)
BLOB - Binary data (up to 4 GB)
CHAR - Fixed-length character data
CLOB - Character data (up to 4 GB)
DATE - Date and time values
DROP TABLE - it is a statement that moves a table to the
recycle bin
Index – improves the performance of some queries.
LONG - Variable-length character data (up to 2 GB
NUMBER - Variable-length numeric data
RAW and LONG RAW - Raw binary data
ROWID - A base-64 number system representing the unique
address of a row in its table
Sequence – generate numeric values.
Synonym – Gives alternative name to an object.
Table – basic unit of storage composed of rows and columns
VARCHAR- Variable-length character data
View – logically represents subsets of data from one or more
_____________________________________________________________________________________
12
MODULE OF INSTRUCTION
table.
Textbook:
References Oracle Press (2010). Applied Oracle Security
References:
Pratt, Philip J. (2010). Database management systems
Rob, Peter & Coronel, Carlo (2009). Database
Management Systems
Schwalbe, Kathy (2011). Management of Information
Technology Projects
Wheeler, Evan (2011). Security Risk Management :
Building an Information Security Risk Management
Program from the Ground Up
Supplementary Reading and Video Link
Supplementary Reading
https://www.w3schools.in/mysql/ddl-dml-dcl/
http://www.oracle-dba-
online.com/sql/oracle_data_definition_language.htm
https://www.tutorialspoint.com/sql_certificate/using_ddl_statem
ents.htm
Supplementary Video
https://www.youtube.com/watch?v=XIhAhXda6EE
https://www.youtube.com/watch?v=UvymdJ5IjZA
https://www.youtube.com/watch?v=5dszS8TxTJ4
Suggested Reading
SQL Tutorial. In ws3schools, Retrieved from
http://www.w3schools.com/sql/default.asp
Database management system. In Encyclopedia
Britannica, Retrieved from
http://www.britannica.com/EBchecked/topic/152201/
database-management-system-DBMS.
_____________________________________________________________________________________
14
MODULE OF INSTRUCTION
INSERT statement
Insert a new row containing values for each column.
List values in the default order of the columns in the
table.
Optionally, list the columns in the INSERT clause.
Enclose character and date values within single
quotation marks.
Add new rows to a table by using the INSERT
statement:
Syntax:
INSERT INTO tbl_name values (column_list);
In the syntax:
o TBL_NAME - Is the name of the table
o COLUMN_LIST - Is the name of the column
in the table to populate
o VALUES - Is the corresponding value for the
column
_____________________________________________________________________________________
2
MODULE OF INSTRUCTION
Output:
_____________________________________________________________________________________
4
MODULE OF INSTRUCTION
those values with no inputs this is set to NULL in the
INSERT INTO statement. By using this method
automatically column with values set to NULL will
automatically have NULL values.
_____________________________________________________________________________________
6
MODULE OF INSTRUCTION
Output: Old table
DELETE Statement
You can remove existing rows from a table by using
the DELETE statement:
Syntax:
DELETE FROM TBL_NAME
WHERE CONDITION;
In the syntax:
Tbl_name - Is the name of the table
Where condition - Identifies the rows to be deleted,
and is composed of column names, expressions,
constants, subqueries, and comparison operators.
_____________________________________________________________________________________
8
MODULE OF INSTRUCTION
As in the output all rows are deleted if WHERE
clause is omitted.
Lesson Summary:
In this lesson, you should have learned how to use the
following statements:
Terms to Remember!
DELETE – a statement use to remove existing rows
in a table.
DML – stand for Data Manipulation Language.
Explicit method - an Insert statement that Specifies
the NULL keyword in the VALUES clause.
Implicit method - an Insert statement that Omits the
column from the column list.
INSERT - a statement used to add new rows in a
table.
Transaction - consists of a collection of DML
statements that form a logical unit of work.
UPDATE - a statement used to update existing rows
in a table.
References Textbook:
Oracle Press (2010). Applied Oracle Security
References:
Pratt, Philip J. (2010). Database management systems
Supplementary Video
https://www.youtube.com/watch?v=S54W4oSqp7s
https://www.youtube.com/watch?v=vnFu6sBfcSs
https://www.youtube.com/watch?v=0EmMIUvjPbA
Suggested Reading
SQL Tutorial. In ws3schools, Retrieved from
http://www.w3schools.com/sql/default.asp
Database management system. In Encyclopedia
Britannica, Retrieved from
http://www.britannica.com/EBchecked/topic/152201/
database-management-system-DBMS.
SQL. In Encyclopedia Britannica, Retrieved from
http://www.britannica.com/EBchecked/topic/569684/
SQL
Database Administration. In Encyclopedia.com,
Retrieved from
http://www.encyclopedia.com/topic/Database_admini
_____________________________________________________________________________________
10
MODULE OF INSTRUCTION
stration.aspx
SQL. In Encyclopedia.com, Retrieved from
http://www.encyclopedia.com/topic/SQL.aspx
Tutorialspoint.com
oracle.com
apex.oracle.com