alphasil 0 Posted March 29, 2011 Report Share Posted March 29, 2011 Olá ppl; Alguém me poderia dizer se assim está bem essa BD Uma imobiliaria local com 4 tabelas vendas tipo_imovel tipo freguesia Chaves primarias em tipo_imovel, tipo e freguesia, e relaçoes entre estas 3 e a tabela vendas com os mesmos campos. Certo? -- phpMyAdmin SQL Dump -- version 3.2.4 -- http://www.phpmyadmin.net -- -- Máquina: localhost -- Data de Criação: 29-Mar-2011 às 13:01 -- Versão do servidor: 5.1.41 -- versão do PHP: 5.3.1 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!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 utf8 */; -- -- Base de Dados: `jra` -- -- -------------------------------------------------------- -- -- Estrutura da tabela `freguesia` -- CREATE TABLE IF NOT EXISTS `freguesia` ( `id_freguesia` int(6) NOT NULL AUTO_INCREMENT, `freguesia` varchar(25) NOT NULL, PRIMARY KEY (`id_freguesia`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; -- -- Extraindo dados da tabela `freguesia` -- INSERT INTO `freguesia` (`id_freguesia`, `freguesia`) VALUES (1, 'Âncora'), (2, 'Âncora Laje'); -- -------------------------------------------------------- -- -- Estrutura da tabela `tipo` -- CREATE TABLE IF NOT EXISTS `tipo` ( `id_tipo` int(6) NOT NULL AUTO_INCREMENT, `Tipo` varchar(10) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id_tipo`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; -- -- Extraindo dados da tabela `tipo` -- -- -------------------------------------------------------- -- -- Estrutura da tabela `tipo_imovel` -- CREATE TABLE IF NOT EXISTS `tipo_imovel` ( `id_tipo` int(6) NOT NULL AUTO_INCREMENT, `Tipo` varchar(20) NOT NULL, PRIMARY KEY (`id_tipo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ; -- -- Extraindo dados da tabela `tipo_imovel` -- INSERT INTO `tipo_imovel` (`id_tipo`, `Tipo`) VALUES (2, 'Apartamento'), (3, 'Vivenda'), (4, 'Terreno'), (5, 'Projecto'); -- -------------------------------------------------------- -- -- Estrutura da tabela `vendas` -- CREATE TABLE IF NOT EXISTS `vendas` ( `id` int(6) NOT NULL AUTO_INCREMENT, `id_tipo` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `concelho` char(20) CHARACTER SET latin1 NOT NULL, `id_freguesia` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `rua` char(30) CHARACTER SET latin1 NOT NULL, `descricao` text CHARACTER SET latin1, `valor` int(8) DEFAULT NULL, `foto1` varchar(150) COLLATE utf8_unicode_ci NOT NULL, `foto2` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`), KEY `FK_vendas` (`id_freguesia`), KEY `FK_vendas_tipo` (`id_tipo`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=6 ; -- -- Extraindo dados da tabela `vendas` -- INSERT INTO `vendas` (`id`, `id_tipo`, `concelho`, `id_freguesia`, `rua`, `descricao`, `valor`, `foto1`, `foto2`) VALUES (5, 'Apartamento', 'Caminha', 'Ancora', 'Mesquita da Silva', 'T3 amplo', 230000, 'fotos/6659294b60.jpg', ''); /*!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 */; gmc11 Link to post Share on other sites
progster 0 Posted July 5, 2011 Report Share Posted July 5, 2011 Sugiro que melhores o modelo ER. Não resolvo dúvidas por PM. Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now