Actual Oracle installation path operations

Source: Internet
Author: User

Today, we will mainly introduce the Oracle installation path in the Oracle skills learning notes, we hope that you will learn the Oracle installation path in the Oracle skills learning notes after reading this article to give a reference. The following describes the specific content of the article.

Create a sequence with a minimum value of 1 and a serial number with a maximum value of 999999999 to automatically cycle

Create sequence name

 
 
  1. increment by 1   
  2. start with 1   
  3. maxvalue 999999999   
  4. cycle;  

When inserting data into a table, the SQL statement is written as follows:

SQL> insert into table name values (sequence name. nextval, column 1 value, column 2 value );

2. How to change the column name in the table?

Software environment:

1. Windows NT4.0 Oracle 8.0.4

2. Oracle installation path: C: ORANT

Implementation Method:

SQL> create table t2 (new column name) as select * from t1; -- name the column name with the new name

SQL> drop table t1; -- delete table 1

SQL> rename t2 to t1; -- rename TABLE 2 to Table 1

3. How to delete columns in a table?

Software environment:

1. Windows NT4.0 Oracle 8.0.4

2. Oracle installation path: C: ORANT

Implementation Method:

 
 
  1. SQL> create table t2 as select from t1;  

Create a new table with a column in the first table

SQL> drop table t1; -- delete table 1

SQL> rename t2 to t1; -- rename TABLE 2 to Table 1

In Oracle 8i and later versions, you can use the following statements:

4. How to find and delete repeated records in a table

Software environment:

1. Windows NT4.0 Oracle 8.0.4

2. Oracle installation path: C: ORANT

Question:

1. When we want to create a unique index for a table, if the table has duplicate records, it cannot be created successfully.

Method principle:

1. in Oracle, each record has a rowid, which is unique throughout the database,

Rowid determines which data file, block, and row of each record in Oracle.

2. In repeated records, the content of all columns may be the same, but the rowid may not be the same, so as long as the deduplication is determined

You can delete all those with the largest rowid.

3. The following statements use three tips: rowid, subquery, and alias.

Implementation Method:

SQL> create table (

2 bm char (4), -- Encoding

3 mc varchar2 (20) -- name

4)

The above content is a description of the Oracle installation path, and I hope it will help you in this regard.

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.