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
- increment by 1
- start with 1
- maxvalue 999999999
- 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:
- 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.