Learning Module
Learning Module
ORACLE
PREPARE BY:
MR. JEROME C. AGUILAR
SHS FACULTY
Good day our dear students!
Welcome to Computer Programming Oracle: Module 3 for Grade 11!
This module was created and designed for you to learn and for you to be provided with fun and meaningful
activities which will enhance your skills in independent learning.
Please be reminded of the important activities to be accomplished upon the use of this module:
1. Please do the OPENING PRAYER before proceeding to the entire lessons and activities given for the day.
Please take a moment of silence and proceed to the opening prayer.
Opening Prayer
Heavenly Father, who by the light of the Holy Spirit, did instruct the hearts of the faithful, grant that by the same
spirit that we may be truly wise and ever enjoy His consolation. All of these we pray in Jesus name. Amen.
2. Please use and answer your module with love, eagerness and care.
3. All the instructions are clearly written on your module. Please read them carefully and make sure to follow
them faithfully.
4. Please read and understand the intended lesson for the day.
5. Please observe honesty and integrity in accomplishing the tasks given.
6. Please practice to have a motivating mood, patience and perseverance in understanding and accomplishing
the self – learning module.
7. You have to finish the tasks at hand before proceeding to the next. Make sure no activities will be neglected.
8. Please be reminded that all the activities and lessons on the module must be finished on the given time
frame.
9. After finishing the module, make sure to submit this on the given schedule.
10. Once all the lesson and activities were accomplished, please do not forget to do the CLOSING PRAYER.
Please take another moment of silence and proceed to the closing prayer.
If you encounter problems or difficulties in answering this module, please do not hesitate to address your
concerns to the responsible teacher. The contact number of the teacher and the consultation hours are
provided in this module. Please bear in mind that you have someone that will guide and will help you in
finishing your module.
It is with a positive mind that this material will really help you to have meaningful learning and gain deep
understanding of the most essential learning competencies intended for this subject. We hope that you will be
fully equipped with the necessary knowledge that will enhance you into a wholesome human being.
TOGETHER EVERYONE ACHIEVES MORE!
Enjoy your module! Thank you and God bless!
LEARNING OBJECTIVES:
Upon the completion of this module, you will be able to:
The names of tables and columns can be up to 30 characters and must begin with a letter. These
limitations apply only to a table or column name, not to data in a column.
The names of tables and columns can’t contain any blank spaces.
Numbers, the underscore symbol (_), and the number sign (#) are allowed in table and column names.
Each table owned by a user should have a unique table name, and the column names in each table
should be unique.
Oracle 11g “reserved words,” such as SELECT, DISTINCT, CHAR, and NUMBER, can’t be used for
table or column names.
Now that the table’s contents have been determined, the columns can be designed. When you create a table in
Oracle 11g, you must define each column. Before you can create the columns, however, you must do the
following:
The keywords CREATE TABLE instruct Oracle 11g to create a table. Optionally, a schema can be included to
indicate who “owns” the table. For example, if the person creating the table is also the person who owns the
table, the schema can be omitted, and the current username is assumed by default.
Defining Columns
After entering the table name, you define the columns to be included in the table. A table can contain a
maximum of 1000 columns. The CREATE TABLE syntax requires enclosing the column list in parentheses. If
the table contains more than one column, the name, datatype, and width (if applicable) are listed for the first
column before the next column is defined. Commas separate columns in the list. The CREATE TABLE
command also allows assigning a default value to a column. The default value is the one Oracle 11g stores
automatically if the user makes no entry in the column.
Viewing a List of Tables: USER_TABLES
Recall that you can query the data dictionary to verify all existing tables in your schema. The USER_TABLES
data dictionary object maintains information on all your tables.
SELECT table_name FROM user_tables;
Table Creation with Subqueries
A nested query, or subquery, is required to create this new table based on the existing CUSTOMERS table. A
subquery is a SELECT statement used in another SQL command. Any type of action you can perform with a
SELECT statement (such as filtering rows, filtering columns, and calculating aggregate amounts) can be
performed when creating a table with a subquery.
To create a table containing data from existing tables, you can use the CREATE TABLE command with an AS
clause containing a subquery.
You should keep the following rules in mind when using the DROP COLUMN clause:
• Unlike using ALTER TABLE with the ADD or MODIFY clauses, a DROP COLUMN clause can
reference only one column.
• If you drop a column from a table, the deletion is permanent. You can’t “undo” the damage if you delete
the wrong column accidentally. The only option is to add the column back to the table and then
manually reenter all the data it contained previously.
• You can’t delete the last remaining column in a table. If a table contains only one column and you try to
delete it, the command fails, and Oracle 11g returns an error message.
• A primary key column can’t be dropped from a table
Renaming a Table
Oracle 11g allows changing the name of any table you own by using the RENAME . . . TO command.
Truncating a Table
When a table is truncated, all rows in the table are removed, but the table itself remains. In other words, the
columns still exist, even though no values are stored in them. This action is basically the same as deleting all
rows in a table. However, if you simply delete all rows in a table, the storage space these rows occupy is still
allocated to the table. To delete the rows stored in a table and free up the storage space they occupied, use
the TRUNCATE TABLE command.
Deleting a Table
You can remove a table from an Oracle 11g database by issuing the DROP TABLE command.
Closing Prayer
We give you thanks Almighty Father through your son Jesus Christ for all the benefits you have given us to you
who live and reign forever and ever. Amen.
Well done! So you have successfully completed the activities and tasks for Module 3. It is expected that you
have gained insights and meaningful experiences. What a great achievement! Again, CONGRATULATIONS
AND GOD BLESS!
Mr. Jerome C. Aguilar 09953674865 Monday – Friday 7:00 p.m. to 8:00 p.m.