Diapositiva 1 - Tesine

annuncio pubblicitario
ISTITUTO SUPERIORE “ITT MARCONI” – ROVERETO
ESAME DI STATO 2015
Alunno: Andrea Tobaldi
Classe: V° B Informatica
Anno Scolastico: 2014-2015
Calcio Trentino
Sito web contenente Classifiche, Calendari, Squadre e Rose
PRESENTAZIONE DEL SITO
Link del sito
The subjects involved in this project are:
- Sistemi e Reti
- Informatica
- Tecnologie Informatiche
Technologies
- HTML/CSS
- JavaScript
- Jquery
- MYSQL
- JSON
- Web Service
- Bootstrap
PROGETTAZIONE DEL
DATABASE
Definizione di database
Definizione di DBMS
DBMS
(Data Base Management System)
Istruzioni del linguaggio SQL
Linguaggio
- CREATE VIEW, GRANT, REVOKE, ecc
DCL (data control language)
- CREATE TABLE, ALTER TABLE, ecc
DDL (data definition language)
- INSERT, UPDATE, DELETE
DML (data manipulation language)
- SELECT
QL (query language)
- CREATE INDEX, ecc
DSL (data storage language)
TIPI DI MODELLI PER LA
BASE DI DATI
-Gerarchico
-Reticolare
-Relazionale
L’IMPORTANZA DELLA
PROGETTAZIONE
La progettazione del modello di dati avviene a modelli diversi:
-MODELLO CONCETTUALE
-MODELLO LOGICO
- MODELLO FISICO
MODELLO CONCETTUALE
DIAGRAMMA/MODELLO ENTITÀ-RELAZIONE (ER)
Gli elementi di un modello entità/associazioni sono:
-Entità
- Associazioni
-Attributi
ASSOCIAZIONI TRA ENTITÀ
- Associazione uno ad uno (1:1)
- Associazione uno a molti (1:N)
- Associazione molti a molti (N:N)
MODELLO CONCETTUALE USATO NEL PROGETTO
MODELLO RELAZIONALE USATO NEL PROGETTO
GIOCATORE (IdGiocatore, Nome, Cognome, Ruolo, DataAnno, IdSquadra)
SQUADRA (IdSquadra, Nome, Paese, Stemma, Lat, Lon, IdCategoria, IdPartita)
CATEGORIA (IdCategoria, NomeCampionato, Girone)
ALLENATORE (IdAllenatore, Nome, Cognome, IdSquadra)
PARTITA (IdPartita, Giornata, SquadraCasa, SquadraFuori, GolCasa, GolFuori,
IdCategoria)
Chiave Primaria
Chiave Esterna
PROGETTAZIONE LOGICA
CREATE TABLE - SQUADRA
create table if not exists Squadra
(
Id_Squadra integer not null auto_increment,
Nome varchar(100) not null,
Paese varchar(100) not null,
Stemma varchar(40),
Lat double,
Lon double,
Id_Categoria integer not null,
primary key (Id_Squadra),
foreign key(Id_Categoria) references Categoria(Id_Categoria)
);
PROGETTAZIONE LOGICA
CREATE TABLE - GIOCATORE
create table if not exists Giocatore
(
Id_Giocatore integer not null auto_increment,
Nome varchar(40) not null,
Cognome varchar(40) not null,
Ruolo varchar(40) not null,
DataAnno integer,
Id_Squadra integer not null,
primary key (Id_Giocatore),
foreign key(Id_Squadra) references Squadra(Id_Squadra),
check (ruolo = "portiere" or ruolo = "difensore" or ruolo = "centrocampista"
or ruolo = "attaccante")
);
PROGETTAZIONE LOGICA
CREATE TABLE - ALLENATORE
create table if not exists Allenatore
(
Id_Allenatore integer not null auto_increment,
Nome varchar(40) not null,
Cognome varchar(40) not null,
Id_Squadra integer not null,
primary key (Id_Allenatore),
foreign key(Id_Squadra) references Squadra(Id_Squadra)
);
PROGETTAZIONE LOGICA
CREATE TABLE - PARTITA
create table if not exists Partita
(
Id_Partita integer not null auto_increment,
Giornata integer not null,
SquadraCasa integer not null,
SquadraFuori integer not null,
GolCasa integer,
GolFuori integer,
Id_Categoria integer not null,
primary key (Id_Partita),
foreign key(Id_Categoria) references Categoria(Id_Categoria),
foreign key(SquadraCasa) references Squadra(Id_Squadra),
foreign key(SquadraFuori) references Squadra(Id_Squadra)
);
INTERROGAZIONI SQL
1) Ricavare tutte le informazioni di una squadra tramite il nome
select * from
squadra join categoria on squadra.Id_Categoria = categoria.Id_Categoria
where Nome = "NomeSquadra";
2) Ricavare i risultati di una giornata calcistica tramite l'IdCategoria e
l'IdGiornata
select partita.Giornata,
(select squadra.Nome from squadra where id_Squadra =
partita.SquadraCasa) as SquadraCasa,
(select squadra.Nome from squadra where id_Squadra =
partita.SquadraFuori) as SquadraFuori, partita.GolCasa, partita.GolFuori
from
partita join categoria on partita.Id_Categoria = categoria.Id_Categoria
where categoria.Id_Categoria = "IdCategoria" and partita.Giornata =
"IdGiornata";
INTERROGAZIONI SQL
3) Ricavare la lista dei giocatori di una squadra tramite il nome della
squadra
select giocatore.* from
giocatore join squadra on giocatore.Id_Squadra = squadra.Id_Squadra
where squadra.Nome ='NomeSquadra';
Grazie dell’attenzione
Scarica