Difference between revisions of "Oracle:Initial Queries"

From mi-linux
Jump to navigationJump to search
Line 1: Line 1:
 +
[[Main Page]] >> [[Oracle|Oracle and SQL]] >> [[Oracle_Getting_Started|Getting Started]] >> Initial Queries
 +
 
== Initial Queries ==
 
== Initial Queries ==
  

Revision as of 20:37, 15 February 2016

Main Page >> Oracle and SQL >> Getting Started >> Initial Queries

Initial Queries

Try the following commands and exercises:

Getting Information about the Attributes of a Table

To get a description of a particular table use the DESCRIBE command.

To describe the table EMP:

 describe emp 

Note, describe is a command proprietary to Oracle and is not part of the SQL standard. These commands are part of the Plus commands Oracle provides and do not need a semi-colon after them.

Exercise 1

Type in the SQL code to display the structure of the CUSTOMER table.

The result should be similar to the following:

Name                                      Null?    Type
----------------------------------------- -------- ----------------------------
CNO                                                NUMBER(4)
ORDERDATE                                          DATE
NAME                                               VARCHAR2(15)
CITY                                               VARCHAR2(15)
COUNTRY                                            VARCHAR2(15)
PNO                                                NUMBER(4)
DESCRIPTION                                        VARCHAR2(20)
QTY                                                NUMBER(4)

Type in the following commands separately:

 describe dept
 select * from dept;
 select * from emp;
 describe salgrade
 select * from salgrade;


Make notes on how the results differ.

Next Step

This concludes setting up the Oracle database. Return now to the Workbook for the next section.