Introduction to Schema Builder
Introduction
Schema Builder
allows you to define the tables, views,
snapshots, synonyms, constraints, and table
relationships that will make up your
database. You can visualize your database
design, including the tables, columns, data
types, and relationships, and then execute
that design.
Hands-On
In this
Hands-On, you will learn how to: Create the
�students� table, Define columns, Define
attributes, Define Primary key, Define
require field, Define Unique Key, Grant
Privileges to public, Check what other users
can access, Remove table, and Check table
access.
Open Schema
Builder tool
Open the
�Schema Builder� tool.
Login as
�oracle� password �learning,� and click on
�connect.�
Click on the
�OK� button.
Maximize the
window if needed.
Create a table
Choose the
�Schema� option, select �Create Table�, then
click on �Table.�
You should see
the �+� sign next to your cursor. Drag your
�+� sign cursor and release it.
Resize your
object if needed.
Rename a table
Choose the
�Data� option and click on �Rename Table.�
In the �Rename
Table� window, change the �Table1� name to
�Students,� and then click �OK� to rename
the table.
Add columns
and attributes
Click on the
plus sign next to the �COLUMN1� object to
add new columns.
In the �Define
Column� window in the �Column Name� box,
type �Student_id;� its column attributes;
and make it a Primary Key. Use any
reasonable attributes to your column (Data
type, Length, Default value, Primary key,
Unique Key, or Required). Notice on the
different attribute options available to you
in the �Data Type� box.
Click on "new
column."
Type "first_name,"
its column attributes; and make it a
required field.
Click on "new
column."
Type "last_name,"
its column attributes; and make it a
required field.
Click on "new
column."
Type "ssn" for
social security number, its column
attributes; and make it an unique key.
Click �OK.�
Your table will be created.
SQL statement
To check on
the SQL statement, choose the "schema�
option, and click on "Show SQL." Now, you
should be able to see your SQL statement in
the �Schema Editor: Show SQL� window.
Save table in
the database
To save your
table in the database, click on �COMMIT� to
create the table, and then
Close the
window.
Now, the table
was created.
Grant access
privileges
To assign or
grant privileges to others to access to your
tables, choose the "File" option, and click
on "Set privileges.�
In the �Set
Schema Privileges� window, you will see all
your tables and all the Roles privileges
that you are able to grant.
Assign the
�Students� table to the public. Select the
�Students� table and the �PUBLIC� role by
highlighting them. Notice that the
�Privileges� box will change to white from
gray.
Give select
and insert privileges to the public by check
mark them.
Click on
"apply," and then close the window.
Now, the
public users can only �insert� and �select�
from the table.
Drop a table
Now, let�s
drop the table.
Choose the
�Schema" option and click on �Remove.�
The gray color
indicates the object was removed.
Exit from
�schema builder," and Click on "yes" to
commit changes.
Questions:
Q:
How can you
create a table using the "Schema Builder"
tool?
Q:
How can you
define a column, attribute, and primary key
using the "Schema Builder" tool?.
Q:
How can you
define a required field and unique key using
the "Schema Builder" tool?.
Q:
How can you
grant an object privilege to the public
using the "Schema Builder" tool?
Q:
How can you
check what other users can access using the
"Schema Builder" tool?
Q:
How can
you remove a table using the "Schema
Builder" tool? |