CREATE TABLE persons AS SELECT name, surname FROM person;
CREATE TABLE table_name(
column1 datatype,
column2 datatype,
.....
columnN datatype,
PRIMARY KEY( one or more columns )
);
CREATE TABLE is the keyword telling the database system what you want to do. In this case, you want to create a new table. The unique name or identifier for the table follows the CREATE TABLE statement.
SQL> CREATE TABLE CUSTOMERS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25) ,
PRIMARY KEY (ID)
);
You can verify if your table has been created successfully by using DESC command as follows:
SQL> DESC CUSTOMERS;
Field | Type | Null | Key | Default | Extra
--------+---------------+------+-----+---------+------
ID | int(11) | NO | PRI | |
NAME | varchar(20) | NO | | |
AGE | int(11) | NO | | |
ADDRESS | char(25) | YES | | NULL |
Ввійдіть щоб вподобати
Ввійдіть щоб прокоментувати