-- MySQL dump 10.15  Distrib 10.0.34-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: localhost    Database: corridas
-- ------------------------------------------------------
-- Server version	10.0.34-MariaDB-0ubuntu0.16.04.1

/*!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 */;
/*!40101 SET NAMES utf8mb4 */;
/*!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 `carro`
--

DROP TABLE IF EXISTS `carro`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `carro` (
  `codCarro` int(11) NOT NULL AUTO_INCREMENT,
  `nomeModelo` varchar(45) NOT NULL,
  `descricaoModelo` varchar(150) DEFAULT NULL,
  `potenciaModelo` varchar(45) DEFAULT NULL,
  `codFabricante` int(11) DEFAULT NULL,
  `valor` decimal(11,2) DEFAULT NULL,
  PRIMARY KEY (`codCarro`),
  KEY `fk_codFabricant` (`codFabricante`),
  CONSTRAINT `fk_codFabricant` FOREIGN KEY (`codFabricante`) REFERENCES `fabricante` (`codFabricante`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `carro`
--

LOCK TABLES `carro` WRITE;
/*!40000 ALTER TABLE `carro` DISABLE KEYS */;
INSERT INTO `carro` VALUES (1,'Sportage LX','16V Flex Aut','2.0',10,56900.00),(2,'Elantra','GLS 16V Flex Aut','2.0',9,56900.00),(3,'488 Spider','3.9 V8','670cv',1,56900.00),(4,'Focus Fastback','TIT./T. Plus Flex Aut','2.0',2,67700.00),(5,'Civic','Sedan SE Flex 16V','1.8',8,99999.00),(6,'V60 T-4','Kinectic 5p','2.0 190cv',3,67700.00),(7,'Cruze','LT FlexPower 4p Mec.','1.8 16V',7,67700.00),(8,'Sandero','Sport RS Hi-Power 5p','2.0 16V',4,67700.00),(9,'Yaris WRC','Gasolina 1.6l','385cv',5,67700.00),(10,'Freelander2','SI4 SE Aut. 5p','2.0 240cv',6,99999.00),(11,'Fiesta','Turbo sport','2.0 turbo',2,49999.00),(12,'Outlander','Turbo sport','2.0 turbo',14,49999.20),(13,'Freemont','Sport ELX','2.4 16V',11,64900.50),(14,'Toro','GLX turbo','3.0 16V',11,74900.55),(15,'Sandero','Turbo extra','3.0 8V',13,54900.55),(16,'Lancer','Turbo XLS','3.0 16V',14,84999.13);
/*!40000 ALTER TABLE `carro` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `equipe`
--

DROP TABLE IF EXISTS `equipe`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `equipe` (
  `codEquipe` int(11) NOT NULL AUTO_INCREMENT,
  `nomeEquipe` varchar(45) NOT NULL,
  `codPais` int(11) DEFAULT NULL,
  PRIMARY KEY (`codEquipe`),
  KEY `fk_codPa` (`codPais`),
  CONSTRAINT `fk_codPa` FOREIGN KEY (`codPais`) REFERENCES `pais` (`codPais`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `equipe`
--

LOCK TABLES `equipe` WRITE;
/*!40000 ALTER TABLE `equipe` DISABLE KEYS */;
INSERT INTO `equipe` VALUES (1,'Toyota Racing',5),(2,'Adapta World Rally Team',11),(3,'BRC Racing Team',6),(4,'D-Max Racing',6),(5,'DMACK World Rally Team',7),(6,'Yazeed Racing',13),(7,'M-Sport World Rally Team',7),(8,'Eurolamp World Rally Team',14),(9,'Brazil World Rally Team',1);
/*!40000 ALTER TABLE `equipe` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `etapas`
--

DROP TABLE IF EXISTS `etapas`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `etapas` (
  `codEtapa` int(11) NOT NULL AUTO_INCREMENT,
  `Local_corrida` varchar(45) NOT NULL,
  `dataEtapa` date DEFAULT NULL,
  `codPais` int(11) DEFAULT NULL,
  PRIMARY KEY (`codEtapa`),
  KEY `fk_codPai` (`codPais`),
  CONSTRAINT `fk_codPai` FOREIGN KEY (`codPais`) REFERENCES `pais` (`codPais`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `etapas`
--

LOCK TABLES `etapas` WRITE;
/*!40000 ALTER TABLE `etapas` DISABLE KEYS */;
INSERT INTO `etapas` VALUES (1,'São Paulo','2017-07-16',1),(2,'Michigan','2017-08-13',2),(3,'Córdoba','2017-08-27',3),(4,'Tolouse','2017-09-10',4),(5,'Tokyo','2017-09-24',5),(6,'Monza','2017-10-08',6),(7,'Londres','2017-10-22',7),(8,'Gotemburgo','2017-11-12',8),(9,'Seul','2017-12-10',9),(10,'Wellington','2018-02-04',10),(11,'Curitiba','2018-02-25',1),(12,'Detroit','2018-03-04',2),(13,'Buenos Aires','2018-03-25',3),(14,'Paris','2018-04-08',4),(15,'Yokohama','2018-04-15',5);
/*!40000 ALTER TABLE `etapas` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `fabricante`
--

DROP TABLE IF EXISTS `fabricante`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `fabricante` (
  `codFabricante` int(11) NOT NULL AUTO_INCREMENT,
  `nomeFabricante` varchar(45) NOT NULL,
  `codPais` int(11) DEFAULT NULL,
  PRIMARY KEY (`codFabricante`),
  KEY `fk_codP` (`codPais`),
  CONSTRAINT `fk_codP` FOREIGN KEY (`codPais`) REFERENCES `pais` (`codPais`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `fabricante`
--

LOCK TABLES `fabricante` WRITE;
/*!40000 ALTER TABLE `fabricante` DISABLE KEYS */;
INSERT INTO `fabricante` VALUES (1,'Ferrari',6),(2,'Ford',2),(3,'Volvo',8),(4,'Renault',4),(5,'Toyota',5),(6,'Land Rover',7),(7,'Chevrolet',2),(8,'Honda',5),(9,'Hyundai',9),(10,'Kia Motors',9),(11,'Fiat',6),(12,'General Motors',2),(13,'Renault',4),(14,'Mitsubishi',5);
/*!40000 ALTER TABLE `fabricante` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `pais`
--

DROP TABLE IF EXISTS `pais`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pais` (
  `codPais` int(11) NOT NULL AUTO_INCREMENT,
  `nomePais` varchar(45) NOT NULL,
  PRIMARY KEY (`codPais`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `pais`
--

LOCK TABLES `pais` WRITE;
/*!40000 ALTER TABLE `pais` DISABLE KEYS */;
INSERT INTO `pais` VALUES (1,'Brasil'),(2,'USA'),(3,'Argentina'),(4,'França'),(5,'Japão'),(6,'Itália'),(7,'Inglaterra'),(8,'Suécia'),(9,'Coreia do Sul'),(10,'Nova Zelândia'),(11,'Noruega'),(12,'Finlândia'),(13,'Arábia Saudita'),(14,'Ucrânia'),(15,'Estônia');
/*!40000 ALTER TABLE `pais` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `piloto`
--

DROP TABLE IF EXISTS `piloto`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `piloto` (
  `licencaPiloto` int(11) NOT NULL AUTO_INCREMENT,
  `nomePiloto` varchar(45) NOT NULL,
  `codPais` int(11) DEFAULT NULL,
  `codEquipe` int(11) DEFAULT NULL,
  `codCarro` int(11) DEFAULT NULL,
  `datanascimento` date DEFAULT NULL,
  PRIMARY KEY (`licencaPiloto`),
  KEY `fk_codEquip` (`codEquipe`),
  KEY `fk_codCarr` (`codCarro`),
  KEY `fk_codPaiss` (`codPais`),
  CONSTRAINT `fk_codCarr` FOREIGN KEY (`codCarro`) REFERENCES `carro` (`codCarro`),
  CONSTRAINT `fk_codEquip` FOREIGN KEY (`codEquipe`) REFERENCES `equipe` (`codEquipe`),
  CONSTRAINT `fk_codPaiss` FOREIGN KEY (`codPais`) REFERENCES `pais` (`codPais`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `piloto`
--

LOCK TABLES `piloto` WRITE;
/*!40000 ALTER TABLE `piloto` DISABLE KEYS */;
INSERT INTO `piloto` VALUES (1,'Henning Solberg',11,2,4,'1998-12-08'),(2,'Jari-Matti Latvala',12,1,9,'1999-11-08'),(3,'Robert Kubica',6,3,7,'1997-10-08'),(4,'Felice Re',6,4,8,'1996-09-08'),(5,'Juho Hanninen',12,1,9,'1995-08-08'),(6,'Ott Tanak',7,5,4,'1994-07-08'),(7,'Yazeed Al-Rajhi',13,6,10,'1996-11-13'),(8,'Eric Camilli',4,7,3,'1992-05-08'),(9,'Bryan Bouffier',4,7,2,'1999-04-11'),(10,'Valeriy Gorban',14,8,6,'1998-03-31'),(11,'Mait Maarend',15,8,5,'1997-02-03'),(12,'Daniel Oliveira',1,9,1,'1996-01-13');
/*!40000 ALTER TABLE `piloto` 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 2018-07-25 10:01:53
ALTER TABLE carro ADD ano YEAR NOT NULL AFTER codFabricante; 
