MySQL's
tech resource article on database normal forms is an excellent read.
NEW!!! - A large (160MB, 4M record)
sample database with test suite for MySQL -- fantastic for running "real" queries.
In addition, MySQL provides a number of sample databases for testing purposes; personally, I find
this one to be the most useful for playing around with SQL statements and such.
The Zip Code Database Project exists to provide US Zip Codes in their entirety; latitude and longitude coordinates included! The downloads are in CSV and MySQL table dump formats.
Also, there's an pretty good online
"data generator", and SQL is one of the options... although personally, I prefer the
integers table approach (courtesy of Baron Schwartz):
set @num_gamers := 10000,
@num_countries := 5,
@num_games := 10;
drop table if exists gamer;
drop table if exists game;
drop table if exists country;
drop table if exists score;
drop table if exists semaphore;
create table gamer(
gamer int not null,
country int not null,
name varchar(20) not null,
primary key(gamer)
);
create table game(
game int not null,
name varchar(20) not null,
primary key(game)
);
create table score(
gamer int not null,
game int not null,
score int not null,
primary key(gamer, game),
index(game, score),
index(score)
);
create table country(
country int not null,
name varchar(20) not null,
primary key(country)
);
-- I use the integers table to generate large result sets.
drop table if exists integers;
create table integers(i int not null primary key);
insert into integers(i) values(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
insert into country(country, name)
select t.i * 10 + u.i, concat('country', t.i * 10 + u.i)
from integers as u
cross join integers as t
where t.i * 10 + u.i < @num_countries;
insert into game(game, name)
select t.i * 10 + u.i, concat('game', t.i * 10 + u.i)
from integers as u
cross join integers as t
where t.i * 10 + u.i < @num_games;
insert into gamer(gamer, name, country)
select th.i * 1000 + h.i * 100 + t.i * 10 + u.i,
concat('gamer', th.i * 1000 + h.i * 100 + t.i * 10 + u.i),
floor(rand() * @num_countries)
from integers as u
cross join integers as t
cross join integers as h
cross join integers as th;
insert into score(gamer, game, score)
select gamer.gamer, game.game, floor(rand() * @num_gamers * 10)
from gamer
cross join game;