Oracle Database Basic Operations

Source: Internet
Author: User

Create user user name password is sqltrain

Create user Sqltrain identified by Sqltrain

Assigning permissions to user names

Grant resource,dba,connect to Sqltrain;

Change Password

alter user Sqltrain identified by Sqltrain

Lock user

alter user Sqltrain account lock

Unlock Users

alter user sqltrain account unlock

log in with Sqltrain

Student Table student (Sno), student name (sname),affiliation Unit (sdree) , Learner Age (Sage), student gender (ssex)

Create Table Student (       Sno  numberprimarykey,       sname    VARCHAR2(),  sdreevarchar2,       Sage     Number ,       ssex   varchar2())

To modify a table add a field

alter table student Add (susername varchar2())

Modify a table modify a field gender length is 10

alter table Student Modify (ssex varchar2(ten))

Delete a table

DROP TABLE student

Renaming a table

Rename student to Stu

Delete data

Deleting a record does not release the block table space that is occupied in Oracle. It only marks those chunks of data that have been deleted as unused.

If you are sure you want to delete all the records from a large table, you can use the TRUNCATE command, which frees up the data block table space that is occupied

If the table automatically grows the DELETE key ID then automatically grows before

Truncate key starts from 1, truncate statement cannot be rolled back

DELETE from table name WHERE condition;

Delete from student

TRUNCATE table name;

TRUNCATE TABLE student

Oracle Database Basic Operations

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.