First, create a table
Grammar:
CREATE TABLE [schema.] Table
(column Datatype[,column datatype[,...]);
Description
CREATE TABLE: A keyword for creating tables.
Schema: Represents the owner of the object, which is the name of the schema, and if the user creates the table in his or her own mode, you can not specify the owner's name.
Table: Represents the name of the table
Column: Represents the name of the columns
DataType represents the data type and width of the column.
Example:
-- Membership Form Create Table User ( number not null, varchar2( null) ,
varchar2 (notnull
)
The above is to create a user table, which indicates that the following naming rules should be followed strictly.
1. Indicate that the first letter should be a letter.
2. You cannot use the Oracle reserved word to name the table.
3. The maximum length indicated is 30 characters.
4. Different tables in the same user mode cannot have the same name.
4. You can use blind spending, numbers and letters, but you can't use spaces and single quotes.
5. The table name, column name, user name, and other object names in Oracle are case-insensitive, and the system is automatically converted to uppercase.
Second, modify the table
ALTER TABLE, in order to modify tables structure commands, you can use the ALTER TABLE directive when you need to add new columns to the original table, modify the original columns, delete the original columns, add constraints, delete constraints, and so on.
To change the syntax of an existing column:
ALTER TABLE <tablename> MODIFY (column definition ...);
Cases:
The length of the modified user name and password is 50;
ALTER TABLE VARCHAR2(VARCHAR2())
To add a new column syntax:
ALTER TABLE <tablename> ADD (column definition ...);
Cases:
Add Phone and address
ALTER TABLE T_user ADD VARCHAR2 (VARCHAR2(+))
To delete the syntax for an existing column in a table:
ALTER TABLE <tablename> DROP COLUMN colmn;
Cases:
Delete Phone and address
ALTER TABLE T_user DROP (tel,address)
Third, delete the table
Grammar:
DROP TABLE <tablename>;
Example: Deleting a user table
DROP TABLE T_user;
Oracle Foundation (vii) Data sheet