· 7 years ago · Sep 14, 2018, 03:22 AM
1CREATE DATABASE IF NOT EXISTS `flag` /*!40100 DEFAULT CHARACTER SET utf8 */;
2USE `flag`;
3-- MySQL dump 10.13 Distrib 5.5.16, for Win32 (x86)
4--
5-- Host: localhost Database: flag
6-- ------------------------------------------------------
7-- Server version 5.5.25a
8
9/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
10/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
11/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
12/*!40101 SET NAMES utf8 */;
13/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
14/*!40103 SET TIME_ZONE='+00:00' */;
15/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
16/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
17/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
18/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
19
20--
21-- Table structure for table `titulo_academicos`
22--
23
24DROP TABLE IF EXISTS `titulo_academicos`;
25/*!40101 SET @saved_cs_client = @@character_set_client */;
26/*!40101 SET character_set_client = utf8 */;
27CREATE TABLE `titulo_academicos` (
28 `idtitulo_academicos` int(11) NOT NULL AUTO_INCREMENT,
29 `nome` varchar(45) DEFAULT NULL,
30 PRIMARY KEY (`idtitulo_academicos`),
31 UNIQUE KEY `nome_UNIQUE` (`nome`)
32) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
33/*!40101 SET character_set_client = @saved_cs_client */;
34
35--
36-- Dumping data for table `titulo_academicos`
37--
38
39LOCK TABLES `titulo_academicos` WRITE;
40/*!40000 ALTER TABLE `titulo_academicos` DISABLE KEYS */;
41INSERT INTO `titulo_academicos` VALUES (1,NULL),(2,'Dr.'),(5,'Drª'),(4,'Engª'),(3,'Engº');
42/*!40000 ALTER TABLE `titulo_academicos` ENABLE KEYS */;
43UNLOCK TABLES;
44
45--
46-- Table structure for table `cargos`
47--
48
49DROP TABLE IF EXISTS `cargos`;
50/*!40101 SET @saved_cs_client = @@character_set_client */;
51/*!40101 SET character_set_client = utf8 */;
52CREATE TABLE `cargos` (
53 `idcargos` smallint(6) NOT NULL AUTO_INCREMENT,
54 `descricao` varchar(50) NOT NULL,
55 PRIMARY KEY (`idcargos`)
56) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
57/*!40101 SET character_set_client = @saved_cs_client */;
58
59--
60-- Dumping data for table `cargos`
61--
62
63LOCK TABLES `cargos` WRITE;
64/*!40000 ALTER TABLE `cargos` DISABLE KEYS */;
65INSERT INTO `cargos` VALUES (1,'Outro'),(2,'Comercial'),(3,'Diretor comercial'),(4,'Diretor Geral');
66/*!40000 ALTER TABLE `cargos` ENABLE KEYS */;
67UNLOCK TABLES;
68
69--
70-- Table structure for table `contactos`
71--
72
73DROP TABLE IF EXISTS `contactos`;
74/*!40101 SET @saved_cs_client = @@character_set_client */;
75/*!40101 SET character_set_client = utf8 */;
76CREATE TABLE `contactos` (
77 `idcontactos` int(11) NOT NULL AUTO_INCREMENT,
78 `nome` varchar(150) NOT NULL,
79 `telemovel` varchar(15) DEFAULT NULL,
80 `email` varchar(50) DEFAULT NULL,
81 `dept` varchar(100) DEFAULT NULL,
82 `idcargos` smallint(6) NOT NULL,
83 `idtitulo_academicos` smallint(6) NOT NULL,
84 `idclientes` int(11) NOT NULL,
85 PRIMARY KEY (`idcontactos`),
86 KEY `FK_CONTACTOS1` (`idcargos`),
87 CONSTRAINT `FK_CONTACTOS1` FOREIGN KEY (`idcargos`) REFERENCES `cargos` (`idcargos`) ON DELETE CASCADE ON UPDATE CASCADE
88) ENGINE=InnoDB DEFAULT CHARSET=utf8;
89/*!40101 SET character_set_client = @saved_cs_client */;
90
91--
92-- Dumping data for table `contactos`
93--
94
95LOCK TABLES `contactos` WRITE;
96/*!40000 ALTER TABLE `contactos` DISABLE KEYS */;
97/*!40000 ALTER TABLE `contactos` ENABLE KEYS */;
98UNLOCK TABLES;
99
100--
101-- Table structure for table `clientes`
102--
103
104DROP TABLE IF EXISTS `clientes`;
105/*!40101 SET @saved_cs_client = @@character_set_client */;
106/*!40101 SET character_set_client = utf8 */;
107CREATE TABLE `clientes` (
108 `idclientes` int(11) NOT NULL AUTO_INCREMENT,
109 `nome` varchar(150) NOT NULL,
110 `nif` varchar(15) NOT NULL,
111 `morada` varchar(250) NOT NULL,
112 `cp` varchar(8) DEFAULT NULL,
113 `localidade` varchar(45) NOT NULL,
114 `idpaises` smallint(6) NOT NULL,
115 `telefone` varchar(15) DEFAULT NULL,
116 `fax` varchar(15) DEFAULT NULL,
117 `email` varchar(45) DEFAULT NULL,
118 PRIMARY KEY (`idclientes`),
119 UNIQUE KEY `nome_UNIQUE` (`nome`),
120 UNIQUE KEY `nif_UNIQUE` (`nif`),
121 KEY `FK_CLIENTES1` (`idpaises`),
122 CONSTRAINT `FK_CLIENTES1` FOREIGN KEY (`idpaises`) REFERENCES `paises` (`idpaises`) ON DELETE CASCADE ON UPDATE CASCADE
123) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
124/*!40101 SET character_set_client = @saved_cs_client */;
125
126--
127-- Dumping data for table `clientes`
128--
129
130LOCK TABLES `clientes` WRITE;
131/*!40000 ALTER TABLE `clientes` DISABLE KEYS */;
132INSERT INTO `clientes` VALUES (2,'HP','PT3242423','Rua deAlém,13','1000-222','Lisboa',1,NULL,NULL,NULL);
133/*!40000 ALTER TABLE `clientes` ENABLE KEYS */;
134UNLOCK TABLES;
135
136--
137-- Table structure for table `paises`
138--
139
140DROP TABLE IF EXISTS `paises`;
141/*!40101 SET @saved_cs_client = @@character_set_client */;
142/*!40101 SET character_set_client = utf8 */;
143CREATE TABLE `paises` (
144 `idpaises` smallint(6) NOT NULL AUTO_INCREMENT,
145 `nome` varchar(60) NOT NULL,
146 PRIMARY KEY (`idpaises`)
147) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
148/*!40101 SET character_set_client = @saved_cs_client */;
149
150--
151-- Dumping data for table `paises`
152--
153
154LOCK TABLES `paises` WRITE;
155/*!40000 ALTER TABLE `paises` DISABLE KEYS */;
156INSERT INTO `paises` VALUES (1,'Portugal');
157/*!40000 ALTER TABLE `paises` ENABLE KEYS */;
158UNLOCK TABLES;
159/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
160
161/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
162/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
163/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
164/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
165/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
166/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
167/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
168
169-- Dump completed on 2012-07-24 19:22:19