Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Common SQL commands (oracle) for operation and maintenance

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Copy table structure and table data:

Create table table_name_new as select * from table_name_old

Copy the table structure:

Create table table_name_new like table_name_old

Copy table data:

Insert into K20_JDBC_TMP select * from K20_JDBC

Set to empty field data to-1:

Update K20_JDBC_TMP set JDBCTIME_MS=-1 WHERE JDBCTIME_MS is NULL

Clear the table data:

Truncate table K20_JDBC_TMP

Rename the table name:

ALTER TABLE old_name RENAME TO new_name

Or

Rename table to table_new

Syntax for adding fields:

Alter table tablename add (column datatype [default value] [null/not null], … .)

Alter table K20_JDBC_TMP2 add T1 CHAR (20) default null; / / is empty by default

Modify the syntax of the field:

Alter table tablename modify (column datatype [default value] [null/not null], … .)

Alter table K20_JDBC_TMP2 modify T1 CHAR (30) default null

Syntax for deleting a field:

Alter table tablename drop (column)

Alter table K20_JDBC_TMP2 drop column T1

Compare the data differences between the two tables:

Select * from B minus select * from A

Selecet pno,cno from A minus select pno,cno from B

Compare two tables with the same structure and insert different data into the third table.

Insert into K20_JDBC_TMP2 (TMZDIFF,WRITETIME,NODE,TIMESTAMP,IP,NODENAME,SERVERNAME,PROVIDERNAME,JDBCNAME,CREATECOUNT,CLOSECOUNT,POOLSIZE,FREEPOOLSIZE,USEDMAX_PCT,JDBCTIME,WAITTIME,USETIME,WAITINGTHREADCOUNT,JDBCTIME_MS,WAITTIME_MS,USETIME_MS) select * from K20_JDBC MINUS SELECT * FROM K20_JDBC_TMP

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report