- or download this
# Diagram 1
+-----+-----------------+--------+-----------+------+
...
| 498 | Crying | Bjork | Debut | 1993 |
| 499 | One Day | Bjork | Debut | 1993 |
+-----+-----------------+--------+-----------+------+
- or download this
# Diagram 2
+-----+-----------------+--------+-----------+------+
...
| 494 | Isobel,Cover Me | Bjork | Telegram | 1996 |
| 495 | Crying,One Day | Bjork | Debut | 1993 |
+-----+-----------------+--------+-----------+------+
- or download this
CREATE TABLE songs (
id int(11) NOT NULL auto_increment,
...
year varchar(4) default NULL,
PRIMARY KEY (id)
);
- or download this
CREATE TABLE song (
id int(11) NOT NULL auto_increment,
title varchar(65) default NULL,
PRIMARY KEY (id)
);
- or download this
CREATE TABLE artist (
id int(11) NOT NULL auto_increment,
name varchar(65) default NULL,
PRIMARY KEY (id)
);
- or download this
CREATE TABLE album (
id int(11) NOT NULL auto_increment,
...
FOREIGN KEY index_artist_id(artist_id)
REFERENCES artist(id)
);
- or download this
CREATE TABLE song (
id int(11) NOT NULL auto_increment,
...
FOREIGN KEY index_album_id(album_id)
REFERENCES album(id)
);
- or download this
mysql: select * from mp3.song limit 3;
+----+--------------------------------+----------+
...
| 2 | Bjork |
| 3 | Pink Floyd |
+----+-------------+
- or download this
mysql: select artist.name from artist
inner join album on artist.id=album.artist_id
...
+------+
| U2 |
+------+
- or download this
$VAR1 = {
'Bjork' => {
...
#etc...
}
};
- or download this
use strict;
...
select LAST_INSERT_ID()
")->[0]->[0]
}
- or download this
# orginal First Normal Form table
mysql: select artist,album,title,year
...
| 10,000 Maniacs | In My Tribe | Cherry Tree | 1987 |
+----------------+-------------+-----------------+------+
2 rows in set (0.04 sec)
- or download this
# 1st form
mysql: update songs set name="Bjork"
...
where name="Bork";
Rows matched: 1 Changed: 1