Advertisement
jorgefox

Banco de Dados StoneHenge

May 22nd, 2012
1,286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.93 KB | None | 0 0
  1. CREATE DATABASE `stonehenge` /*!40100 DEFAULT CHARACTER SET latin1 */;
  2. DROP TABLE IF EXISTS `stonehenge`.`cliente`;
  3. CREATE TABLE  `stonehenge`.`cliente` (
  4.   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  5.   `nome` varchar(50) NOT NULL,
  6.   `endereco` varchar(50) NOT NULL,
  7.   `bairro` varchar(30) NOT NULL,
  8.   `cidade` varchar(30) NOT NULL,
  9.   `estado` char(2) NOT NULL,
  10.   `telefone` varchar(14) NOT NULL,
  11.   `cpf` varchar(14) NOT NULL,
  12.   PRIMARY KEY (`id`),
  13.   KEY `Index_cpf` (`cpf`)
  14. ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
  15. DROP TABLE IF EXISTS `stonehenge`.`assuntos`;
  16. CREATE TABLE  `stonehenge`.`assuntos` (
  17.   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  18.   `cpf` varchar(14) NOT NULL,
  19.   `assunto` varchar(30) NOT NULL,
  20.   PRIMARY KEY (`id`),
  21.   KEY `FK_assuntos_cpf` (`cpf`),
  22.   CONSTRAINT `FK_assuntos_cpf` FOREIGN KEY (`cpf`) REFERENCES `cliente` (`cpf`)
  23. ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement