Oracle PL/SQL:CREATE TABLE statement: create a table with primary key.CREATE TABLE statement can be used to create table objects in database. It is possible to add constraints like primary key ,foreign key while table creation.Primary key is the unique identifier for a row of data.One ...
create_table_statement ::=CREATETABLE[ IFNOTEXISTS] table_identifier'('column_definition (','column_definition )*','PRIMARYKEY'('primary_key')'(','{KEY|INDEX} [index_identifier] [USINGindex_method_definition ] [ INCLUDE column_identifier (','column_identifier )*] [WITHindex_options ] )*...
CREATE [TEMPORARY] TABLEtable(field1 type[(size)] [NOT NULL] [WITH COMPRESSION | WITH COMP] [index1] [,field2type[(size)] [NOT NULL] [index2] [, ...]] [, CONSTRAINTmultifieldindex[, ...]]) The CREATE TABLE statement has these parts: Remarks Use the CREATE TABLE statement to d...
.. (Some valid select or union statement) CREATE TABLE creates a table with the given name. You must have the CREATE privilege for the table. By default, tables are created in the default database, using the InnoDB storage engine. An error occurs if the table exists, if there is no ...
For more information, see Section 15.1.20.3, “CREATE TABLE ... LIKE Statement”. [AS] query_expression To create one table from another, add a SELECT statement at the end of the CREATE TABLE statement: CREATE TABLE new_tbl AS SELECT * FROM orig_tbl; For more information, see Sec...
For example, in the AdventureWorks database, theProductVendortable has a referential relationship with theVendortable. TheProductVendor.VendorIDforeign key references theVendor.VendorIDprimary key. If a DELETE statement is executed on a row in theVendortable, and an ON DELETE CASCADE action is spec...
SQL CREATE TABLE Statement Example The following example creates a table namedproductwith columns namedproduct_nbr,product_name,product_status_code,start_date,end_dateandraw_material_cost_amt. This SQL CREATE TABLE Statement is executed: CREATE TABLE product ( product_nbr int NOT NULL, ...
Let see how to code a CREATE TABLE statement below,CREATE TABLE TB_TAB1 (TAB1_COL1 INTEGER NOT NULL PRIMARY KEY, TAB1_COL2 INTEGER NOT NULL, TAB1_COL3 VARCHAR(5) REFERENCES ZIPCODE(ZIP) ON DELETE CASCADE, TAB1_COL4 DATE WITH DEFAULT, TAB1_COL5 CHAR(20) NOT NULL UNIQUE, TAB1_...
CREATE TABLE statementThe CREATE TABLE statement defines a table. The definition must include its name and the names and attributes of its columns. The definition can include other attributes of the table, such as its primary key and its table space. Invocation for CREATE TABLE This statement ...
通过CREATE TABLE [IF NOT EXISTS] <table_name> [LIFECYCLE <days>] AS <select_statement>;语句可以再创建一个表,并在建表的同时将数据复制到新表中。 但通过该语句创建的表不会复制分区属性,只会把源表的分区列作为目标表的一般列处理,也不会复制源表的生命周期属性。 您还可以通过lifecycle参数回收表。同...