Your first homework will be a small console application that connects to an SQL database via JDBC, queries some data, and updates the database.
I've put some song information into the database assignment1 in a table songs. A sample of some of the data in the table is:
| song | artist | album | genre | duration | discNumber | discCount | trackNumber | trackCount | year |
|---|---|---|---|---|---|---|---|---|---|
| varchar(50) | varchar(50) | varchar(50) | varchar(20) | int | int | int | int | int | int |
| Acquiesce | k.d. lang | All You Can Eat | Country | 212 | 1 | 1 | 6 | 10 | 1995 |
| Angels Would Fall | Melissa Etheridge | Breakdown | Rock | 279 | 1 | 1 | 2 | 14 | 1999 |
| Are You Gonna Go My Way | Lenny Kravitz | Greatest Hits | Rock | 211 | 1 | 1 | 1 | 15 | 2000 |
This table could be built in MySql using the SQL:
CREATE TABLE songs (
song varchar(50) NOT NULL default '',
artist varchar(50) NOT NULL default '',
album varchar(50) NOT NULL default '',
genre varchar(20) default NULL,
duration int(11) default NULL,
discNumber int(11) default NULL,
discCount int(11) default NULL,
trackNumber int(11) default NULL,
trackCount int(11) default NULL,
year int(11) default NULL
) TYPE=MyISAM;
INSERT INTO songs VALUES ('Acquiesce','k.d. lang','All You Can Eat','Country',
212,1,1,6,10,1995);
INSERT INTO songs VALUES ('Angels Would Fall','Melissa Etheridge',
'Breakdown','Rock',279,1,1,2,14,1999);
INSERT INTO songs VALUES ('Are You Gonna Go My Way','Lenny Kravitz',
'Greatest Hits','Rock',211,1,1,1,15,2000);
For homework 1, write code that determines the number of songs with durations greater than 240 seconds. Plus feel free to just do something else interesting with the data. Add your own songs if you want.