Database Programming INFT224

Bryant & Stratton College

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 TABLE STATE

(

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','Washington');

insert into state values ('NY','New York');

insert into state values ('CA','California');

insert into state values ('FL','Florida');

 

(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;