1. Create table
CREATE TABLE TEST
(
ID NUMBER(16) NOT NULL
, USERID VARCHAR(30)
, TITLE VARCHAR(30)
, PROBLEMIDS VARCHAR(30)
, PRACTICETIME VARCHAR(30) , ANSWERS
VARCHAR(30)
, CREATETIME DATE
, PRIMARY KEY (ID) -- set the primary key
);
COMMENT ON COLUMN TEST.ID IS 'Exercise Id';
COMMENT ON COLUMN TEST.USERID IS 'User Id';
COMMENT ON COLUMN TEST.TITLE IS 'Exercise title';
COMMENT ON COLUMN TEST .PROBLEMIDS IS 'Problem Id Collection';
COMMENT ON COLUMN TEST.PROBLEMIDS IS 'Problem Id Collection';
COMMENT ON COLUMN TEST.PRACTICETIME IS 'Practice Duration';
COMMENT ON COLUMN TEST.CREATETIME IS 'Practice Time';
2. Drop table
Drop table table name
3. Modify the data type of the attributes of the
table alter table table name modify field name type;
4. Create a sequence
CREATE SEQUENCE emp_sequence --emp_sequence sequence name
INCREMENT BY 1 -- add several
START WITH 1 each time -- start counting from 1
NOMAXVALUE -- do not set the maximum value
NOCYCLE -- keep accumulating, do not loop
CACHE 10;
5. Add table attributes
Alter table table name add new attribute name add new attribute data type
Example: Alter table book add price integer(10) null
6 .Delete an attribute in the
table alter table table name drop column column name
CREATE TABLE TEST
(
ID NUMBER(16) NOT NULL
, USERID VARCHAR(30)
, TITLE VARCHAR(30)
, PROBLEMIDS VARCHAR(30)
, PRACTICETIME VARCHAR(30) , ANSWERS
VARCHAR(30)
, CREATETIME DATE
, PRIMARY KEY (ID) -- set the primary key
);
COMMENT ON COLUMN TEST.ID IS 'Exercise Id';
COMMENT ON COLUMN TEST.USERID IS 'User Id';
COMMENT ON COLUMN TEST.TITLE IS 'Exercise title';
COMMENT ON COLUMN TEST .PROBLEMIDS IS 'Problem Id Collection';
COMMENT ON COLUMN TEST.PROBLEMIDS IS 'Problem Id Collection';
COMMENT ON COLUMN TEST.PRACTICETIME IS 'Practice Duration';
COMMENT ON COLUMN TEST.CREATETIME IS 'Practice Time';
2. Drop table
Drop table table name
3. Modify the data type of the attributes of the
table alter table table name modify field name type;
4. Create a sequence
CREATE SEQUENCE emp_sequence --emp_sequence sequence name
INCREMENT BY 1 -- add several
START WITH 1 each time -- start counting from 1
NOMAXVALUE -- do not set the maximum value
NOCYCLE -- keep accumulating, do not loop
CACHE 10;
5. Add table attributes
Alter table table name add new attribute name add new attribute data type
Example: Alter table book add price integer(10) null
6 .Delete an attribute in the
table alter table table name drop column column name