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...") |
|||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | [[Main Page]] >> [[Oracle|Oracle and SQL]] >> [[Oracle_Workbook|Workbook]] >> [[Oracle_Getting_Started|Getting Started]] >> Initial Queries | ||
+ | |||
== Initial Queries == | == Initial Queries == | ||
Line 13: | Line 15: | ||
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. | 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 == | + | == Exercise 1.1 == |
Type in the SQL code to display the structure of the CUSTOMER table. | Type in the SQL code to display the structure of the CUSTOMER table. | ||
Line 19: | Line 21: | ||
The result should be similar to the following: | The result should be similar to the following: | ||
+ | <pre style="color: blue"> | ||
Name Null? Type | Name Null? Type | ||
----------------------------------------- -------- ---------------------------- | ----------------------------------------- -------- ---------------------------- | ||
Line 29: | Line 32: | ||
DESCRIPTION VARCHAR2(20) | DESCRIPTION VARCHAR2(20) | ||
QTY NUMBER(4) | QTY NUMBER(4) | ||
+ | </pre> | ||
+ | |||
+ | 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 [[Oracle_Workbook|Workbook]] for the next section. |
Latest revision as of 15:50, 24 February 2016
Main Page >> Oracle and SQL >> Workbook >> 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.