You are on page 1of 38

Data Management

Dr. Philip Cannata 1


Dr. Philip Cannata 2
Extenuating Circumstances

If you have difficulty meeting the requirements of this course, fail to hand in an assignment,
or miss an exam because of extenuating circumstances, please advise your instructor in
writing (not email) at the earliest possible date so that your situation can be discussed. If you
encounter an unexpected medical or family emergency or a random act of Nature that causes
you to miss the due date for homework or miss a quiz or exam, you must present suitable
documentation in writing (not email) to the instructor before special consideration will be
given.

A file of all written correspondence will be kept by the instructor and decisions
regarding them will be made at the end of the semester.

Dr. Philip Cannata 3


Piazza

Dr. Philip Cannata 4


Caution: This Class Uses Oracle Software

Oracle 11g DBMS


SQLDeveloper
SQLDeveloper Data Modeler
APEX
Oracle RDF/OWL

Dr. Philip Cannata 5


Oracle Certification

Dr. Philip Cannata 6


Course Overview

Dr. Philip Cannata 7


SQLDeveloper

Dr. Philip Cannata 8


SQLDeveloper

cs347_UTEId at UT

New Connection cs347_UTEId

orcl_UTEId

Dr. Philip Cannata 9


Murah Chapter 2

How to use
Oracle SQL Developer and other tools

Dr. Philip Cannata 10


Objectives You wont be able
to do this to the
Applied UT database.
Start or stop the Oracle database server and listener.
Use SQL*Plus to run a SQL statement.
Use Oracle SQL Developer to do any of the following:
Create a database connection
Export or import database connections
Navigate through the objects of a database
View the column definitions for a table
View the data for a table
Edit the column definitions for a table
Use Oracle SQL Developer to enter, run, open, and save SQL
statements and scripts.
Use the SQL Reference manual to look up information about SQL
statements.

Dr. Philip Cannata 11


Objectives (continued)
Knowledge
Briefly describe the function of each of these products:
Database Home Page
SQL*Plus
Oracle SQL Developer
SQL Reference manual

Dr. Philip Cannata 12


How to stop the database
You wont be able
StartAll Programs to do this to the
Oracle Database 10g Express Edition UT database.
Stop Database

The DOS window when the database is stopped

Dr. Philip Cannata 13


How to start the database
You wont be able
StartAll Programs to do this to the
Oracle Database 10g Express Edition UT database.
Start Database

The DOS window when the database is started

Dr. Philip Cannata 14


Terms to know
Database service (database server, database engine)
Database listener

Dr. Philip Cannata 15


The UT Oracle database system is
not Express Edition, its Enterprise
The Database Home Page Edition.

Dr. Philip Cannata 16


How to start the Database Home Page from the
Windows Start menu You wont be able
All Programs to do this to the
Oracle Database 10g Express Edition UT database.
Go To Database Home Page.
Use the Database Login page to log in.

How to use the Database Home Page to create a


user for a database
You wont be able
Log in as the system user. to do this to the
Administration UT database.
Database Users
Create User.
Use the resulting web page to create the user.

Dr. Philip Cannata 17


The SQL*Plus tool

Dr. Philip Cannata 18


How to start SQL*Plus
Select the Run command from the Start menu.
Enter sqlplus, and click the OK button.

How to connect to a database with SQL*Plus


Enter the username and password.

How to run a SQL statement with SQL*Plus


Type the statement.
Type a semicolon, and press the Enter key.

Dr. Philip Cannata 19


The SQL Developer dialog box for creating
database connections

Dr. Philip Cannata 20


How to create a database connection
Right-click on the Connections node.
Select the New Connection command.
Enter a connection name, username, and password.
Click the Test button to test the connection.
Click the Save button to save the connection.

Dr. Philip Cannata 21


How to export database connections
Right-click the Connections node.
Select the Export Connections command.
Select the connections that you want to export.
Specify the path and filename for the XML file for the connections.

How to import database connections


Right-click the Connections node.
Select the Import Connections command.
Navigate to the XML file for the connections.
Select the connections that you want to import.

Dr. Philip Cannata 22


The Connection Information dialog box

Dr. Philip Cannata 23


The tables available to the AP user

Dr. Philip Cannata 24


The column definitions for a table

Dr. Philip Cannata 25


How to view the column definitions for a table
Click on the name of the table in the Connections window.
By default, the columns are displayed in the sequence in which
they were created.

How to view the data for a table


Click on the Data tab.

Dr. Philip Cannata 26


Editing the column definition of a table

Dr. Philip Cannata 27


A SELECT statement and its results

Dr. Philip Cannata 28


How to change the connection for a worksheet
Use the Connections list

How to comment out or uncomment a line


Press Ctrl+/.

Two ways to execute a SQL statement


Press the F9 key.
Click the Execute Statement button in the toolbar.

Dr. Philip Cannata 29


Using the snippets window

Dr. Philip Cannata 30


Handling syntax errors

Dr. Philip Cannata 31


Common causes of errors
Misspelling the name of a table or column
Misspelling a keyword
Omitting the closing quotation mark
Being connected as the wrong user

Dr. Philip Cannata 32


The Open File dialog box

Dr. Philip Cannata 33


Three ways to open a SQL file
Click the Open button in the toolbar.
Press Ctrl+O.
Select the FileOpen command.

How to switch between open statements


Select the appropriate tab.

How to cut, copy, and paste code


Use the standard Windows techniques.

Dr. Philip Cannata 34


Three ways to save a SQL file
Click the Save button in the toolbar.
Press Ctrl+S.
Select the FileSave command.

How to change the default directory


for new statements
Use the ToolsPreferences command.
Expand the Database node.
Click on the Worksheet Parameters node.
Change the default path for scripts.

Dr. Philip Cannata 35


A SQL script and its results

Dr. Philip Cannata 36


How to run an entire SQL script
Press F5 or click the Run Script button.

How to run one statement within a script


1. Move the cursor into the statement you want to execute.
2. Press F9 or click the Execute Statement button.

Note
The results of a statement are displayed in the Results tab.
The results of a script are displayed in the Script Output tab.

Dr. Philip Cannata 37


The Oracle Database SQL Reference manual

Dr. Philip Cannata 38