Commands in Oracle with MySQL show databases, show tables, desc table similar command set

Source: Internet
Author: User
Tags mysql show databases sqlplus

1 How to execute a SQL script file, this script file writes a series of sets of SQL statements, such as Sql.sql placed under D:\MyEclipse 8.6\workspaces\oasystem\webroot\sql.sql

"CD D:\MyEclipse 8.6\workspaces\oasystem\webroot\

>>sqlplus

>>@ Sql.sql;

2 How to view the table you just created



Sql> Select table_name from User_tables;

SQL Plus commands, almost all in the page above.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| sqldoc |
| test |
+--------------------+
4 rows in Set (0.00 sec)

One instance of Oracle is a database, so there is no corresponding show databases statement

So for Oracle:



1 What database currently exists:

C:\windows\system32>sqlplus

Sql*plus:release 10.2.0.3.0-production on Saturday June 22 17:51:39 2013

Copyright (c) 1982, 2006, Oracle. All rights Reserved.

Please enter your username: Scott
Enter Password: Tiger

Sql> Conn sys/a123 as SYSDBA;
is connected.

Sql> select name from V$database;

NAME
---------

ORCL1

mysql> Show Tables
;
+----------------+
| Tables_in_test |
+----------------+
| sale_report |
| test_dysql |
| union_tab_1 |
| union_tab_2 |
| v_sale_report |
+----------------+
5 rows in Set (0.00 sec)

Oracle uses the following statement to implement

sql> SELECT
2 table_name
3 from
4 All_tables
5 WHERE
6 ROWNUM <;

table_name
------------------------------------------------------------
icol$
con$
undo$
proxy_role_data$
file$
uet$
ind$
seg$
col$

9 rows selected.

mysql> desc sale_report;
+------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------------+------+-----+---------+-------+
| Sale_date | datetime |     NO | |       NULL | |
| Sale_item | varchar (2) |     NO | |       NULL | |
| Sale_money | Decimal (10,2) |     NO | |       NULL | |
+------------+---------------+------+-----+---------+-------+
3 rows in Set (0.00 sec)

Oracle

sql> desc all_tab_columns
Name Null? Type
----------------------------------------- -------- ----------------------------

OWNER not NULL VARCHAR2 ($)
table_name not NULL VARCHAR2 (+)
column_name not NULL VARCHAR2 (+)
data_type VARCHAR2 (106)
data_type_mod VARCHAR2 (3)
Data_type_owner VARCHAR2 (+)

Commands in Oracle with MySQL show databases, show tables, desc table similar command set

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.