Day 1) JDK and Oracle setup _20180528 pm
[Afternoon session _ Database]
SQL: Structured Query Language
1. Data Definition Language — DDL
1) create — create an object
2) alter — change an object (structure change)
3) drop — delete an object
2. Data Manipulation Language — DML
1) insert — insert data
2) update — modify data
3) delete — delete data
4) select — search data
3. Data Control Language — DCL
1) grant — grant privilege
2) revoke — revoke privilege
4. Transaction Control Language — TCL
1) commit — apply the transaction permanently
2) rollback — return to the last commit
3) savepoint — temporary save
How to connect to a DBMS
1. Windows cmd
-> Windows Home > cmd
sqlplus sys/java@localhost:1521 as sysdba
2. Oracle cmd
-> Windows Home > All Programs > run SQL Command Line
conn sys /as sysdba
password
3. SQL Developer
Run SQL Developer
+ (bt)
Connection name, username, password
Option (SYSDBA)
Test (bt) -> success (state)
Test (editor) -> select * from all_users;
Play (bt)
Registering accounts and granting privileges in the database
0. Admin activates the listener.
cmd
sqlplus sys/java@localhost:1521 as sysdba;
1. Admin registers a user account
create user userid identified by userpw
2. Admin grants privileges to the user account
grant connect, resource, sysdba to userid
3. Admin revokes privileges from the user account
revoke connect, resource. sysdba from userid
4. User changes their own password
cmd
sqlplus userid/java@localhost:1521 as sysdba;
alter user userid identified by newpw <- but uid cannot be registered