Home > Database > SQL > What is the Oracle table creation statement?

What is the Oracle table creation statement?

angryTom
Release: 2020-03-02 15:44:20
Original
16310 people have browsed it

What is the Oracle table creation statement?

What is the Oracle table creation statement?

Oracle database table creation statement, the specific syntax is as follows:

CREATE TABLE tablename(
    column_name datatype [null,not null],
    column_name datatype [null,not null],
    ......[constraint]
)
Copy after login

Recommended《 SQL Tutorial

Syntax description:

tablename: The table name of the table that needs to be created in the database. The table name in the same database cannot Duplicate;

column_name: The column name of the created table, the column name cannot be repeated in a table;

datatype: The data type of the data stored in the column of the created table;

null, not null: Allow the column to be empty or not empty. By default, it is not empty;

constraint: Set constraints for the columns in the table, such as primary key constraints and foreign keys. Constraints, unique constraints, etc.;

Example:

create table table_name(
    id numner(12),		
    text verchar2(255 CHAR) not null,   	--char类型,一个汉字占一个长度
    PID varchar2(32 BYTE) NOT NULL,   	--byte类型,UTF8一个汉字占大约两个长度
    status number(1) DEFAULT 0 null  	--添加默认值 如果为空默认值就为0
)
Copy after login

For more Oracle and SQL tutorials, please pay attention to PHP Chinese website!

The above is the detailed content of What is the Oracle table creation statement?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template