Basic Oracle Database Operations

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.