CCS0021L (Information Management) (F3-Formative) Formative Assessment 3
CCS0021L (Information Management) (F3-Formative) Formative Assessment 3
CCS0021L
(INFORMATION MANAGEMENT)
[F3-FORMATIVE]
Formative Assessment 3
EXERCISE
5
INTRODUCTION TO SQL
Section: DO21
Professor: Mr. Tim Awat
Then click on Oracle Database, and click Autonomous Database. See Figure 19
Figure 19
Figure 20
25. Figure 24
3. Then login to Administration Services by writing the password (this is the password you have
chosen during creation of the Autonomous Database, Refer to figure 22). Then click on Sign In
to Administration.
5. Then create a Database User that will use the database. Write the password and workspace
name. Please take note. Usually the Database User and the WorkSpace Name are the the same.
Then click Create Workspace.
8. Then write the newly created workspace, username and password. Then click sign in.
4. Click on Choose File and Find the hrcreate.txt file provided by your teacher. The Script name
is optional. Then click upload.
9. You should be seeing this below. In the object browser you will see different tables. They
are Countries, Departments, Employees, Jobs, Job_history, Locations, and Regions.
11. Then make sure you click the Play button of the hrpopulate.txt.
17. And you will see that the departments table has data on it because of hrpopulate script.
VI. REFERENCES
• Hoffer, Jeff (2016). Modern Database Management 12th edition. Pearson Education Limited
• Young, M. (2010). Oracle Data Modeling and Relational Database Design, Vol. 1 Student Guide, Oracle.
6
DATA DEFINITION LANGUAGE
Section:
Professor:
Syntax:
CREATE TABLE [schema.]table
(column datatype [DEFAULT expr] [, …]);
Constraints
The Oracle server uses constraints to prevent invalid data entry into tables.
Constraint Description
NOT NULL Specifies that the column cannot contain a null value
Syntax:
column, …
[CONSTRAINT constraint_name] constraint_type
(column, …),
Syntax:
CREATE TABLE table
[(column, column…)]
AS subquery;
Read-Only Tables
You can use the ALTER TABLE syntax to:
• Put a table into read-only mode, which prevents DDL or DML changes during table maintenance
• Put the table back into read/write mode
Syntax:
ALTER TABLE table READ ONLY;
ALTER TABLE table READ WRITE;
Dropping a Table
• Moves a table to the recycle bin
• Removes the table and all its data entirely if the PURGE clause is specified
Syntax:
DROP TABLE table [PURGE];
Inserting Data into the Table
Syntax:
INSERT INTO table [(column [, column…])]
VALUES (value [, value…]);
Syntax:
INSERT INTO table [(column [, column…])]
subquery;
Syntax:
ALTER TABLE table
ADD (column datatype [DEFAULT expr]
Adding a Constraint
Syntax:
ALTER TABLE table
ADD (CONSTRAINT constraint_name] type column_name;
Dropping a Constraint
Syntax:
ALTER TABLE table
DROP PRIMARY KEY | UNIQUE (column) |
CONSTRAINT constraint [CASCADE];
Syntax:
FLASHBACK TABLE [schema.]table [, [schema.]table]…
TO {TIMESTAMP | SCN} expr;
DO THE FOLLOWING:
How to connect SQL Developer to Oracle Cloud Account
Pre-requisite:
• You have the application SQL developer application.
1. The first thing to do is to get your Database Wallet. You will be needing this later in SQL
developer. Login to your oracle cloud account and go to your autonomous database account.
Click on the display name of your Autonomous Database.
4. Write a password and confirm the password for this wallet. Make sure you remember the
password because you will be needing it later in SQL developer. Then click Download Wallet.
Make sure you know where you saved the wallet you have downloaded.
5. Then run SQL developer.
This is the loading interface of Oracle SQL
Developer.
6. Click the New Connection Icon (the green Plus icon) on the Connections pane.
16. You will see in the Connections pane a plug icon, meaning your SQL developer has
successfully connected to your Oracle Cloud account
19. You will see the same tables you had in the Oracle Cloud.
For each number, copy the source code and paste it here together with the screenshot of the what the table looks
like by its Columns
1. Source code and screenshot of the table for creating the Customer table.,
3. Source code and screenshot of the table for creating the ItemProduct table.
4. Source code and screenshot of the table for creating the Orders table.
6. Source code and screenshot of the table for creating the Requests table.
8. Source code and screenshot of the table for creating the ShipmentItem table.
10. Source code and screenshot of the table for creating the SupplierItem table.
12. Change the Quantity attribute to QTY in the item Table. Copy and paste the source code and screenshot of
the updated table below:
15. Type in Commit on the worksheet, to save the changes made. Copy and paste the code below:
16. Create a new table. Name the table TempTable. Create two attributes of your own, one of the attributes is an
identifier. Copy and paste the source code and screenshot of the updated table below:
17. Delete the table TempTable. Copy the code you have used and take a screenshot of the your Recycle bin
and paste it here:
19. Make the table TempTable to an uneditable table. Copy and paste the source code and screenshot of the
updated table below:
20. Create a comment on the column Customerid of the Customer table. Copy and paste the code below:
• Hoffer, J.A., Prescott, M.B., McFadden, F.R. (2007). Modern Database Management 8th
Edition. New Jersey: Pearson Prentice Hall.