Escolar Documentos
Profissional Documentos
Cultura Documentos
CMPUT 291
File and Database Management
Systems
Goals
Work with SQL statements
DDL and DML statements
SQL overview
SQL*Plus
SQL*Plus is a command line interface to Oracle
databases that can be used to execute SQL statements.
SQL Developer is a graphical user interface to a
database that can be used to browse database objects,
run SQL statements, and build queries.
Oracle is a Database Management System (DBMS).
Oracle supports Structured Query Language (SQL).
Running SQL*Plus
To run SQL*Plus, issue the following command:
sqlplus
You will be promoted for your Oracle user-name and
password.
First time you login, both your Oracle username and
password are your Unix id.
e.g. your Unix id is Johndoe , then your
Oracle username: Johndoe
Oracle password: Johndoe
You will require to change your password the first time you
login!
Changing Password
When you enter SQL*Plus, the prompt will look like:
Run passw command in SQL*Plus prompt:
You will see:
Password Restrictions
Must start with an alphabetic character
May ONLY include alphabetic, numeric, and
underscore characters. No special characters!
Can not be longer than 30 characters.
Not case sensitive.
For security, had better select a password different from
your Unix password!
Help Facility
SQL>help <keyword>
Example: To see help for append command:
SQL>help append
Help command is for SQL*Plus commands only.
Exit SQL*Plus
describe <TableName>;
To see all attributes of movie table:
Select Example
Show all records of movie table
Select Example
Show all records of movie table:
select * from movie;
Show only movie title and year from movie table:
select title, year from movie;
Transactions
Open another session (of SQL*Plus) on your system.
Issue the following command, in the first session:
insert into movie values(T3, 4, 2003);
Committing Transactions
This command commits the current transaction.
All changes made by the transaction become
visible to others and are guaranteed to be
durable if a crash occurs.
commit;
Database Catalogue
Built-in tables that keep information about the
database objects.
Examples: User_Tables and All_Tables .
These tables are managed by Oracle.
You can query these tables to get information
about tables stored in the system.