Create and manage tables in oracle database creation and part of the management ---

For each table database is actually expressed is an object database, the object database and refers to the DDL definition of all the operations, such as: table, view, index, sequence, constraints, etc., are subject to manipulation, Therefore, the establishment of the table is to create an object, and the object of the operation is divided into the following three categories syntax:
create an object: cREATE object name ...;
delete objects: DROP object name ...;
modify objects: ALTER object name ...;
frequently used data fields

each of a data table are actually composed of several fields, each field will have a corresponding data type, the oracle, the commonly used are the following types of data:
strings VARCHAR2 (n-) n-represents the the maximum length of the string can be saved, saving approximately 200 substantially contents
integer NUMBER (n) represents an integer of at most n bits, can sometimes be used in place of INT
fractional NUMBER (n, m) where m is a decimal, nm is an integer bits may be used sometimes instead of FLOAT
dATE at storage datetime
large text CLOB can store vast amounts of text (4Gb), such as a storage like the novel
large objects BLOB store two Ary, for example: movies, MP3, pictures, text

Create a new table
Hypertext Transfer Protocol http + ssl certification --- https - between the application layer and the transport layer plus Ssl built on tcp, three characteristics:
Insert:
Hypertext Transfer Protocol http + ssl certification --- https - between the application layer and the transport layer plus Ssl built on tcp, three characteristics:
Hypertext Transfer Protocol http + ssl certification --- https - between the application layer and the transport layer plus Ssl built on tcp, three characteristics:
View this table:
Hypertext Transfer Protocol http + ssl certification --- https - between the application layer and the transport layer plus Ssl built on tcp, three characteristics:
copy table:
# replicate a table that contains employee information only 20 departments of
SQL> AS the Create the Table emp20 the SELECT * from emp the WHERE deptno = 20;
Hypertext Transfer Protocol http + ssl certification --- https - between the application layer and the transport layer plus Ssl built on tcp, three characteristics:
# structure emp table copy table , not data
SQL> create table empnull as select * from emp where 1 = 2;
Hypertext Transfer Protocol http + ssl certification --- https - between the application layer and the transport layer plus Ssl built on tcp, three characteristics:
table renamed
SQL> rename emp20 to bumen;
Hypertext Transfer Protocol http + ssl certification --- https - between the application layer and the transport layer plus Ssl built on tcp, three characteristics:
truncate table - not rollback
Common deleted - can rollback

#删除表中的数据
DELETE FROM PERSON;
#再次查询表中的内容
SELECT * FROM PERSON;
#回滚事务
ROLLBACK;
#再次查询表中数据
SELECT * FROM PERSON;

Hypertext Transfer Protocol http + ssl certification --- https - between the application layer and the transport layer plus Ssl built on tcp, three characteristics:

截断PERSON表
TRUNCATE TABLE PERSON;
#回滚事务
ROLLBACK;
#再次查询表中数据-----无数据
SELECT * FROM PERSON;
SQL> truncate table bumen;

Hypertext Transfer Protocol http + ssl certification --- https - between the application layer and the transport layer plus Ssl built on tcp, three characteristics:
Delete the table
SQL> drop table bumen;
Hypertext Transfer Protocol http + ssl certification --- https - between the application layer and the transport layer plus Ssl built on tcp, three characteristics:
Flashback
# View the recycle bin
Hypertext Transfer Protocol http + ssl certification --- https - between the application layer and the transport layer plus Ssl built on tcp, three characteristics:
# Restore bumen table
SQL> flashback table bumen to before drop ;
Hypertext Transfer Protocol http + ssl certification --- https - between the application layer and the transport layer plus Ssl built on tcp, three characteristics:
see the trash after deleting the other tables:
Hypertext Transfer Protocol http + ssl certification --- https - between the application layer and the transport layer plus Ssl built on tcp, three characteristics:
delete the recycle bin kong table:
SQL> purge the Table kong ;
Hypertext Transfer Protocol http + ssl certification --- https - between the application layer and the transport layer plus Ssl built on tcp, three characteristics:
empty the Recycle Bin:
SQL> purge RECYCLEBIN;
permanently delete a table without the addition of the Recycle Bin:
increase pURGE keyword.
# Delete MYEMP table does not enter the recycle bin
DROP TABLE MYEMP PURGE;

Published 31 original articles · won praise 19 · views 1451

Guess you like

Origin blog.csdn.net/Alkaid__3/article/details/104294380