Get the App
SLTechnology News&Howtos  ›  Database  › 

Analysis of operation examples of tables in oracle database

Shulou Source: shulou.com Published: 2022-05-31 20:04:58 10月13日 Update

This article mainly shows you the "oracle database table operation example analysis", the content is simple and easy to understand, organized clearly, I hope to help you solve doubts, let Xiaobian lead you to study and learn "oracle database table operation example analysis" this article bar.

1. create tables

create table test_1(num number(2) not null,name VARCHAR2(20) not null,primary key(num));

Created a table with two fields, num and name, both set to non-empty, num set to the primary key, often a "missing left parenthesis" error message when creating the table, estimated to be VARCHAR2 type without adding data length, plus just fine. This is to create a table with sql statements, feel more than right-click to create a new trouble, may sometimes have to build a table like this.

2. replicated table

create table test_2 as select * from test_1;

This copy of the table will copy the data, sometimes we only need the table structure is enough, you can delete the data of the new table, of course, you can directly choose to copy the table structure.

create table test_3 as select * from test_1 where 1=2;

3. delete table

drop table test_1

4. Query all field names in the table

SELECT * FROM user_tab_columns t WHERE t.TABLE_NAME='TEST_1';

The table name should be capitalized, otherwise no information can be found.

5. review the user information

--View all users in the database, provided that you have dba permissions, such as sys,system select * from dba_users; --View all users you can manage! select * from all_users; --View current user information! select * from user_users;

View current user information or more commonly used.

The above is "oracle database table operation sample analysis" all the contents of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Tags: Data information user database table example analysis content time article field structure learning help two premise can be passed uppercase commonly used feel Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MySQL Docker Xiaomi MariaDB