Basic Oracle Database Operations
Basic Oracle database operations.
All usernames and passwords created by Oracle are bkjia
Create user bkjia identified by bkjia
Assign permissions to the user name
Grant resource, dba, connect to bkjia;
Change Password
Alter user bkjia identified by bkjia
Lock user
Alter user bkjia account lock
Unlock a user
Alter user bkjia account unlock
Log On With bkjia
Student ID (sno), student name (sname), enterprise (sdree), student age (sage), student gender (ssex)
Create table student
(
Sno number primary key,
Sname varchar2 (50 ),
Sdree varchar2 (50 ),
Sage number,
Ssex varchar2 (50)
)
Modify a table and add a field
Alter table student add (SUSErname varchar2 (50 ))
Modify the table to change the gender length of a field to 10
Alter table student modify (ssex varchar2 (10 ))
Delete table
Drop table student
Rename a table
Rename student to stu
Delete data
Deleting a record does not release the occupied data block tablespace in ORACLE. It only marks the deleted data blocks as unused.
To delete all records in a large table, run the TRUNCATE command to release the occupied data block tablespace.
If the table automatically grows after the delete operation, the primary key Id increases after the previous operation.
After TRUNCATE, the primary key increases from 1, and the TRUNCATE statement cannot be rolled back.
Delete from table name WHERE condition;
Delete from student
Truncate table name;
Truncate table student