Oracle data Table object
Represents the very important data objects in the oracle database, but also the main objects, today, start to learn the management of tables! 1: data type of the table 1: character type CHAR: string of fixed character length (fast query) vachar2: variable length string field (save space) 2: numeric type number (5Magne2) The following decimal 3: date type DATE default format is determined by the NLS_DATE_FORMAT parameter 4:LOB type BLOB: store music, video, images and other binary files CLOB: character format large object 5:ROWID data type pseudo column type, physical address for storing data records 2: table operation 1: create table CREATE TABLE TABLE_NAME (ID NUMBER (10) NOT NULL....) Learn from a table CREATE TABLE TABLE_NAME AS SELECT * FROM TABLE_NAME1;2: add field ALTER TABLE TABLE_NAME ADD (ID NUMBER (10)); 3: delete field ALTER TABLE TABLE_NAME DROP (NAME1,NAME2); 4: modify field ALTER TABLE TABLE_NAME MODIFY CLOUMN_NAME CLOUMN_PROPERTY5: rename table ALTER TABLE TABLE_OLD_NAME TO NEW_NAME;6: change tablespace and storage parameter ALTER TABLE TABLE_NAME MOVE TABLESPACE TABLESPACE_NAME ALTER TABLE TABLE_NAME PCTFREE 25 PCTUSED 45 set table free space usage 7: delete table DROP TABLE TABLE_ name [cascade CONSTRAINTS] (if there is a constraint on the table, you must add the following parameters) 8: modify the table status to set the read only alter table table_name read only; query status select table_name,read_only from user_table where table_name='table_name' 3: table parameter 1: storage parameter STORAGE (INITIAL 256K) set when creating the table (if you know how big the table is, you can set the size first to avoid fragmentation) IV: table integrity and constraint not null non-empty constraint BOOK_PK primary key (BOOK) the primary key constraint name for creating the BOOK field is BOOK_PKalter table table_name drop book_pk Delete the primary key UNIQUE uniqueness constraint allows the null foreign key constraint foreign key name foreign key (name_id) references table_name2 (column) Disable constraint alter table table_name disable constraint constraint name Delete constraint alter table table_name drop constraint constraint name