Database Programming – INFT224
Spring 2009
Lab 1
Testing your Oracle Account and experimenting with
tables
1. Create a data structure called state, which contains 2 attributes.
(at
the SQL prompt)
CREATE
(
ABBR CHAR(2 BYTE),
NAME VARCHAR2(20 BYTE)
);
2. Verify that your data structure was created correctly:
> describe state;
3. Insert records into your table:
insert
into state values ('WA','
insert
into state values ('NY','
insert
into state values ('CA','
insert
into state values ('FL','
(insert
additional states if desired)
4. View the all the attributes and records within your table:
> select * from state;
5. View the all the
STATE names within your table:
> select name from state;
6. View the all the
STATE abbrieviations within your table:
> select abbr
from state;
7. View states in alphabetical order:
> select name from state order by
name;
8. View states in REVERSE (or descending) alphabetical order:
> select name from state order by
name desc;