Get the App
SLTechnology News&Howtos  ›  Database  › 

How to create and manage tables in Oracle

Shulou Source: shulou.com Published: 2022-05-31 20:37:38 09月23日 Update

This article introduces how to create and manage tables in Oracle. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

Oracle create tables and manage tables

1. Creation and management of table

Creating a table includes three elements, table name, column name, and data type. Each table has different columns, and each column has a unique data type. Introduction to common data types:

The data type describes the CHARACTER (n) character / string. Fixed length n. INTEGER (p) integer value (no decimal point). Precision p. NUMERIC (pforce s) accurate value, precision p, decimal point after the number of s. VARCHAR (n) character / string. Variable length. Maximum length n. INTEGER integer value (no decimal point). The precision is 10. The range of stored data is-2 to the 31st power of 2 to the 31st power of 2, occupying 4 bytes of storage space. DATE stores the values of year, month, and day. TIMESTAMP stores the values of year, month, day, hour, minute, and second.

Related statement

Table1 has the same structure as table2 table

Create table table1

As

Select * from table2

Note: where can be added to restrict the insertion of data.

Note: if you only need to copy the table structure without data, you can add an untenable condition:

Create table table1

As

Select * from table2

Where 1: 2

The second method: copy after creating the table, copy the two columns of column11,column12 data in table2 to the two columns of column1,column2 in table1

Insert into table1 (column1,column2)

Select column11,column12 from table2

Note: where can be added to restrict the insertion of data.

Modify table data: change the data of column1 in table table1 to value2

Update table1

Set column1=value2

Note: where can be added to restrict the modification of data.

Delete data:

The first method: conditional deletion

Delete from table1

Where...

The second method: delete all, delete all data in table1 (non-rollback)

Truncate table table1

On how to create and manage tables in Oracle to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Data management characters types words decimals decimal points numeric values methods precision length storage limits content strings more conditions structures help different Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Tech Info Redmi Xiaomi Apple