9 Ağustos 2011 Salı

F1Racing JSF App (part 1: create database)




Let me guess, your brother-in-law is a F1 supporter and he wanted you develop a small F1Racing application that gives basic info about drivers and teams.
You visualised your app GUI and now start to design database.

As you can see, we have 3 simple tables. Lets create using sql codes:

create table drivers
(
id int not null auto_increment,
primary key(id),
driver varchar(50) not null,
point float

);
create table constructors
(
id int not null auto_increment,
primary key(id),
team varchar(50)
)

create table constructor_driver
(
id int not null auto_increment,
primary key(id),
constructor int,
driver int,
foreign key(constructor) references constructors(id),
foreign key(driver) references drivers(id)
);



now insert some data into tables.

insert into drivers (driver, point) values ('Kimi Raikkonen',50);
insert into constructors (team) values ('Ferrari');


Finally we have our tables as shown:



Hiç yorum yok: