Difference between revisions of "Oracle:Initial Queries"
From mi-linux
Jump to navigationJump to search (Created page with "== 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 t...") |
|||
Line 32: | Line 32: | ||
Type in the following commands: | Type in the following commands: | ||
− | + | describe dept | |
− | + | select * from dept; | |
− | + | select * from emp; | |
− | + | describe salgrade | |
− | + | select * from salgrade; | |
Make notes on how the results differ. | Make notes on how the results differ. |
Revision as of 20:33, 15 February 2016
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:
describe dept select * from dept; select * from emp; describe salgrade select * from salgrade;
Make notes on how the results differ.