Difference between revisions of "Oracle:Initial Queries"

From mi-linux
Jump to navigationJump to search
Line 46: Line 46:
 
   select * from salgrade;
 
   select * from salgrade;
  
→ test sy
+
⇒ Make notes on how the results differ.
› Make notes on how the results differ.
 
  
 
== Next Step ==
 
== Next Step ==
  
 
This concludes setting up the Oracle database. Return now to the [[Oracle_Workbook|Workbook]] for the next section.
 
This concludes setting up the Oracle database. Return now to the [[Oracle_Workbook|Workbook]] for the next section.

Revision as of 13:46, 17 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.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.