[basic operation] 1. Table operation
-1. Basic table operation table drop table user1;create table user1 (id number (5Power3) not null,-- (NPowerM) N: a total of several digits, M: the last few decimal places name varchar2 (10) not null,tel number (11p0) not null); truncate table user1;insert into user1 (id,name,tel) values (23.456 id,name,tel values 22); insert into user1 (id,name,tel) values ((select max (id) from user1) + 1 minaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -- 2. Create table create table user2 as select * from user1;-- copy all fields and data create table user3 as select id,name from user1;-- copy specified fields and data create table user4 as select id gid, name gname from user1;-- set the new table field to the new name create table user5 as select id gid, name gname from user1 where 1 to 2 -- replication structure does not copy data-- 3. Tel-- add field ALTER TABLE "USER4" ADD ("tel" NUMBER (11) DEFAULT 13900001111 NOT NULL);-- delete field ALTER TABLE "USER4" DROP ("tel");-- change table name ALTER TABLE "USER5" RENAME TO "USER55";-- change field name ALTER TABLE "USER4" RENAME COLUMN "tel" TO "randomkey" -- change the attribute ALTER TABLE "USER4" MODIFY ("randomkey" VARCHAR2 (11) DEFAULT 'sha256');-- modify the default value ALTER TABLE "USER4" MODIFY ("GNAME" VARCHAR2 (20), "randomkey" VARCHAR2 (20))