Computer Science, asked by saritapatel2707, 6 months ago

how we can create a new table​

Answers

Answered by vinitsarnaik04
0

Answer:

23,24,25,26,27,28,29

Answered by Anonymous
0

Explanation:

Create

CREATE TABLE [schema.]<TableName>

column datatype [DEFAULT expr] [column_constraint(s)] ,

column datatype [DEFAULT expr] [column_constraint(s)] , ...

[table_constraint | table_ref_constraint]

TABLESPACE <TableSpaceName>;

CREATE TABLE scott.kb (

kb_id number,

title varchar2(50) CONSTRAINT kb_title_nn NOT NULL,

detail CLOB CONSTRAINT kb_detail_nn NOT NULL,

author varchar2(25),

last_modified date,

reviewer varchar2(25),

last_reviewed date,

keywords varchar2(100),

CONSTRAINT kb_pk PRIMARY KEY("KB_ID") USING INDEX TABLESPACE users

)

TABLESPACE users;

Note: UPPER case used for PRIMARY KEY("KB_ID")

Clone Table Method Examples

CREATE TABLE emp2_with_data AS SELECT * FROM emp;

CREATE TABLE emp2_with_nodata AS SELECT * FROM emp WHERE 1=2;

-- Clone a table structure (just structure and no data).

CREATE TABLE new_table AS select * from Table2Clone WHERE 1=0;

When you create do a CTAS (create table as select) of a table you only get the structure and not any indexes, PK, FK etc.

Similar questions