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