Zoo tutorials: [ SQL | Linux | XML ]
ProgZoo: [ Java | C# | VB | C++ | Perl ]
Log in

A Gentle Introduction to
Java Programming

Tutorial: Changing a table

 
In these exercises you complete a routine to change an existing table. The complete program: You are only shown the portion of code that needs to be updated. You can see all the code by ticking the "Show all" box. If you want to run this from your own machine you will need this code plus the SQL to create the bbc table. bbc.sql

1. Using INSERT .. VALUE


Big

In this program a temporary table mega is created. You must write the routine changeMega that adds a row to the table.

Add the new country 'Neverland' with a population of 10.

The SQL insert command you want is

INSERT INTO mega(name,population> VALUES ('Neverland',1)

2. Gotta go


Big

A typical SQL delete command is:

DELETE FROM mega WHERE name='Bolivia'

Delete the countries that have been condemned.

3. Updating values


Big

The String pops includes changes to be made to the table mega.

You will need to build and execute update statements such as:

UPDATE mega
 SET population=9200000
 WHERE name='Bolivia'

Update the table according to details given. Also, remove the println statements.