Oracle Basic Knowledge

Source: Internet
Author: User

Never give up, everything is possible!!!

Only to find a way to succeed, not to find excuses for failure!

Oracle BASIC knowledge SQL statement classification

1. Description of the classification

Four categories: 1) DQL: Data Query Language (language)

2) DML: Data manipulation language (manipulation language)

3) DCL: Data Control Language (language)

4) DDL: Data definition Language (language)

2. Details

1) dql--for retrieving databases (select belongs to DML in Oracle)

SELECT < field name table > from < table or view name > WHERE < query conditions >

2) dml--change data in the database

1) Inserting: Insert
2) Updates: Update
3) Remove: Delete

3) dcl--database authorization and submission

1) Grant: authorization.
2) ROLLBACK [work] to [savepoint]: fallback to a point.
The rollback command brings the database state back to the last committed state. The format is: sql>rollback;
3) Commit [work]: Submit.

4) Creation, modification, deletion of objects in ddl--database

Table/view/index/syn/cluster

Drop and Purg

1. Differences

The drop table is placed in (User_recyclebin), not directly deleted, so that the table information in the Recycle Bin can be restored or completely erased.

drop table table1;//deleted tables in Recycle Bin

drop table table1 Purge; The table is completely deleted

2. Data manipulation in the Recycle Bin

Empty the specified table: Purge table table1;

Clear the current user's Recycle Bin: Purge RecycleBin;

Clear the Recycle Bin for all users: Purge Dba_recyclebin;

Recover deleted tables: Flashback table Table1 to before drop;

CHAR, VARCHAR2, NVARVHAR2

1.char

1) The length of char is fixed, such as defining char (5), inserting AAA, and database automatically adding 2 spaces after AAA

2) Char distinguishes between Chinese and English, two bytes in English and one byte; so char (10) can save 5 characters 10 English characters

3) Maximum Length 2000

4) Usage: fixed length, not including Chinese

Note: You can select the byte and char types when created in Sqldeveloper, and if you choose Byte,char (10) You can store 10 English characters, 5 Chinese characters, and 10 English characters if you choose Char. 10 Chinese characters

2. VarChar and VARCHAR2

1) The length is not fixed, the definition varchar2 (5) To insert AAA only accounted for 3 bytes

2) distinguish between Chinese and English

3) The basic equivalence of VARCHAR2 and varchar (VARCHAR2 is a non-industry standard defined by Oracle VARCHAR,VARCHAR2 the null string equals null processing, while varchar is still treated as an empty string)

4) Maximum 4000

5) Use: Suitable for non-fixed length of the case does not contain Chinese

  Note: 1) You can select the byte and char types when you create them in Sqldeveloper, and if you choose Byte,varchar2 (10) You can store 10 English characters, 5 Chinese characters, or 10 English characters if you choose Char

2) It is recommended to use VARCHAR2 instead of varchar because it is compatible in Oracle

3. Nvarchar and NVARCHAR2

1) Not fixed length

2) do not distinguish between Chinese and English (length defines the number of characters)

3) nvarchar and nvarchar2 are basically equivalent, different in nvarchar2 Chinese and English is also accounted for two characters

4) Usage: Suitable for storing Chinese

Oracle Basic Knowledge

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.