CREATE DATABASE  IF NOT EXISTS `registroautomobilistico` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */;
USE `registroautomobilistico`;
-- MySQL dump 10.13  Distrib 8.0.13, for macos10.14 (x86_64)
--
-- Host: 127.0.0.1    Database: registroautomobilistico
-- ------------------------------------------------------
-- Server version	8.0.13

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
 SET NAMES utf8 ;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `Categorie`
--

DROP TABLE IF EXISTS `Categorie`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `Categorie` (
  `Cod_Categoria` char(2) NOT NULL,
  `Nome_Categoria` varchar(30) DEFAULT NULL,
  PRIMARY KEY (`Cod_Categoria`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `Categorie`
--

LOCK TABLES `Categorie` WRITE;
/*!40000 ALTER TABLE `Categorie` DISABLE KEYS */;
INSERT INTO `Categorie` VALUES ('01','Autovettura'),('02','Rimorchio'),('03','Motociclo'),('04','Furgone');
/*!40000 ALTER TABLE `Categorie` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `Combustibili`
--

DROP TABLE IF EXISTS `Combustibili`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `Combustibili` (
  `Cod_Combustibile` char(2) NOT NULL,
  `Descrizione_Combustibile` varchar(30) DEFAULT NULL,
  PRIMARY KEY (`Cod_Combustibile`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `Combustibili`
--

LOCK TABLES `Combustibili` WRITE;
/*!40000 ALTER TABLE `Combustibili` DISABLE KEYS */;
INSERT INTO `Combustibili` VALUES ('01','Benzina'),('02','Gasolio'),('03','GPL'),('04','Metano');
/*!40000 ALTER TABLE `Combustibili` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `Fabbriche`
--

DROP TABLE IF EXISTS `Fabbriche`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `Fabbriche` (
  `Cod_Fabbrica` char(3) NOT NULL,
  `Nome_Fabbrica` varchar(30) DEFAULT NULL,
  PRIMARY KEY (`Cod_Fabbrica`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `Fabbriche`
--

LOCK TABLES `Fabbriche` WRITE;
/*!40000 ALTER TABLE `Fabbriche` DISABLE KEYS */;
INSERT INTO `Fabbriche` VALUES ('001','Fiat'),('003','Ford'),('004','Piaggio'),('005','Volvo'),('006','Renault'),('007','Toyota'),('008','Volkswagen'),('009','Honda');
/*!40000 ALTER TABLE `Fabbriche` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `Modelli`
--

DROP TABLE IF EXISTS `Modelli`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `Modelli` (
  `Cod_Modello` char(3) NOT NULL,
  `Nome_Modello` varchar(30) DEFAULT NULL,
  `Cod_Fabbrica` char(3) DEFAULT NULL,
  `Numero_Versioni` int(11) DEFAULT NULL,
  PRIMARY KEY (`Cod_Modello`),
  KEY `Cod_Fabbrica` (`Cod_Fabbrica`),
  FOREIGN KEY (`Cod_Fabbrica`) REFERENCES `fabbriche` (`cod_fabbrica`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `Modelli`
--

LOCK TABLES `Modelli` WRITE;
/*!40000 ALTER TABLE `Modelli` DISABLE KEYS */;
INSERT INTO `Modelli` VALUES ('001','Panda','001',3),('002','Vespa','004',4),('003','Brava','001',2),('004','Mondeo','003',3),('005','V-10','005',2),('006','Ducato','001',5),('007','Clio','006',5),('008','Corolla','007',4),('009','Coupè','001',1),('010','Golf','008',4),('011','Megane','006',2),('012','Seicento','001',2),('013','Laguna','006',2),('014','Civic','009',3);
/*!40000 ALTER TABLE `Modelli` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `Proprieta`
--

DROP TABLE IF EXISTS `Proprieta`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `Proprieta` (
  `Targa` varchar(10) NOT NULL,
  `Cod_Proprietario` char(5) NOT NULL,
  `Data_Acquisto` date DEFAULT NULL,
  `Data_Cessione` date DEFAULT NULL,
  PRIMARY KEY (`Targa`,`Cod_Proprietario`),
  KEY `Cod_Proprietario` (`Cod_Proprietario`),
  FOREIGN KEY (`Targa`) REFERENCES `veicoli` (`targa`),
  FOREIGN KEY (`Cod_Proprietario`) REFERENCES `proprietari` (`cod_proprietario`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `Proprieta`
--

LOCK TABLES `Proprieta` WRITE;
/*!40000 ALTER TABLE `Proprieta` DISABLE KEYS */;
INSERT INTO `Proprieta` VALUES ('A123456X','00001','1994-06-20','2001-12-13'),('C78905GT','00003','1994-06-23','2003-02-17'),('C845905Z','00003','1993-11-30','2001-01-06'),('CFT340VB','00004','1996-09-16','2002-08-31');
/*!40000 ALTER TABLE `Proprieta` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `Proprietari`
--

DROP TABLE IF EXISTS `Proprietari`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `Proprietari` (
  `Cod_Proprietario` char(5) NOT NULL,
  `Cognome` varchar(30) DEFAULT NULL,
  `Nome` varchar(30) DEFAULT NULL,
  `Indirizzo` varchar(30) DEFAULT NULL,
  `Provincia` char(30) DEFAULT NULL,
  PRIMARY KEY (`Cod_Proprietario`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `Proprietari`
--

LOCK TABLES `Proprietari` WRITE;
/*!40000 ALTER TABLE `Proprietari` DISABLE KEYS */;
INSERT INTO `Proprietari` VALUES ('00001','Lucchini','Valentina','Viale Pavia, 3','LO'),('00002','Farese','Giulia','Viale Italia, 9','LO'),('00003','Giovanolla','Filippo','Via G.Galilei, 4','LO'),('00004','Spoldi','Diego','Via Croce, 12','LO'),('00005','Spoldi','Simona','Via S.Angelo, 11','LO'),('00006','Bernocchi','Giuseppina','Via Pascoli, 1','LO'),('00007','Cottarelli','Cristian','Via Cannero, 18','MI');
/*!40000 ALTER TABLE `Proprietari` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `Veicoli`
--

DROP TABLE IF EXISTS `Veicoli`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `Veicoli` (
  `Targa` varchar(10) NOT NULL,
  `Cilindrata` int(11) DEFAULT NULL,
  `Cavalli_Fiscali` int(11) DEFAULT NULL,
  `Velocità` int(11) DEFAULT NULL,
  `Posti` int(11) DEFAULT NULL,
  `Immatricolazione` date DEFAULT NULL,
  `Cod_Categoria` char(2) DEFAULT NULL,
  `Cod_Combustibile` char(2) DEFAULT NULL,
  `Cod_Modello` char(3) DEFAULT NULL,
  PRIMARY KEY (`Targa`),
  KEY `Cod_Categoria` (`Cod_Categoria`),
  KEY `Cod_Combustibile` (`Cod_Combustibile`),
  KEY `Cod_Modello` (`Cod_Modello`),
  FOREIGN KEY (`Cod_Categoria`) REFERENCES `categorie` (`cod_categoria`),
  FOREIGN KEY (`Cod_Combustibile`) REFERENCES `combustibili` (`cod_combustibile`),
  FOREIGN KEY (`Cod_Modello`) REFERENCES `modelli` (`cod_modello`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `Veicoli`
--

LOCK TABLES `Veicoli` WRITE;
/*!40000 ALTER TABLE `Veicoli` DISABLE KEYS */;
INSERT INTO `Veicoli` VALUES ('A123456X',1796,85,195,5,'1998-12-30','01','01','004'),('B256787Y',708,10,120,5,'1989-09-21','01','02','001'),('C76589AG',1106,54,130,5,'1998-08-13','01','01','001'),('C78905GT',1998,117,212,4,'1994-11-06','01','01','009'),('C845905Z',NULL,NULL,NULL,3,'1995-04-11','04','03','006'),('CFT340VB',1390,75,170,5,'1995-01-12','01','02','007'),('D239765W',NULL,NULL,NULL,2,'1997-08-12','03','01','002'),('DD4567XX',1581,17,NULL,5,'1997-06-05','01','01','003'),('DGH789JC',1590,114,170,5,'1995-10-05','01','02','014'),('DH79567H',1589,107,170,5,NULL,'01','04','011'),('ERG567NM',1598,107,175,5,'1997-12-18','01','04','013'),('F96154NH',1781,125,185,5,'1992-03-08','01','03','010'),('FGH673FV',899,39,140,5,'1998-08-09','01','01','012'),('XCH56GJK',1918,110,210,5,'1998-09-04','01','01','005'),('XF5789CY',1587,107,175,5,'1996-05-05','01','01','008');
/*!40000 ALTER TABLE `Veicoli` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2019-10-24 10:15:26
