Unconfigured Ad Widget

Collapse

Anúncio

Collapse
No announcement yet.

Banco de dados para mercearia/super mercado

Collapse
X
 
  • Filter
  • Tempo
  • Show
Clear All
new posts

  • Font Size
    #1

    Duvida Banco de dados para mercearia/super mercado

    Boa tarde,

    Alguém teria aí um banco de dados de mercearia/supermercado de preferencia com campo blob com imagens de produtos?

    Obrigado.
    Similar Threads

  • Font Size
    #2
    Banco mercado

    -- phpMyAdmin SQL Dump
    -- version 3.3.9
    -- Apenas usuários registrados e ativados podem ver os links., Clique aqui para se cadastrar...
    --
    -- Servidor: localhost
    -- Tempo de Geração: Jun 12, 2014 as 04:35 PM
    -- Versão do Servidor: 5.1.53
    -- Versão do PHP: 5.3.4

    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 */;

    --
    -- Banco de Dados: `banco-mercadinho-sistema`
    --
    create database bancomercadinhosistema;
    use bancomercadinhosistema;

    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `cidades`
    --

    CREATE TABLE IF NOT EXISTS `cidades` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `cid_nome` varchar(45) DEFAULT NULL,
    `estado_id` int(11) NOT NULL,
    PRIMARY KEY (`id`),
    KEY `fk_cidade_estado1_idx` (`estado_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9715 ;


    -- --------------------------------------------------------
    --
    -- Estrutura da tabela `clientes`
    --

    CREATE TABLE IF NOT EXISTS `clientes` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `email` varchar(45) NOT NULL,
    `endereco_id` int(11) NOT NULL,
    `pessoa_id` int(11) NOT NULL,
    `created` datetime DEFAULT NULL,
    `modified` datetime DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `fk_cliente_endereco1_idx` (`endereco_id`),
    KEY `fk_cliente_pessoas1_idx` (`pessoa_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

    --
    -- Extraindo dados da tabela `clientes`
    --


    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `configs`
    --

    CREATE TABLE IF NOT EXISTS `configs` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `foto_sistema` varchar(100) NOT NULL,
    `idioma` varchar(20) NOT NULL,
    `tema` varchar(40) DEFAULT NULL,
    `nome_sistema` varchar(60) NOT NULL,
    `registros_por_pagina` int(11) NOT NULL,
    `diferenca_entre_botoes_pag` int(11) NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

    --
    -- Extraindo dados da tabela `configs`
    --

    INSERT INTO `configs` (`id`, `foto_sistema`, `idioma`, `tema`, `nome_sistema`, `registros_por_pagina`, `diferenca_entre_botoes_pag`) VALUES
    (1, 'uploads/logomarca-sistema.png', 'por', 'style_default', 'Mercadinho', 4, 3);

    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `configs_boletos`
    --

    CREATE TABLE IF NOT EXISTS `configs_boletos` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `chave` varchar(60) NOT NULL,
    `valor` varchar(100) NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;

    --
    -- Extraindo dados da tabela `configs_boletos`
    --

    INSERT INTO `configs_boletos` (`id`, `chave`, `valor`) VALUES
    (1, 'taxa_boleto', '10'),
    (2, 'especie', 'R$'),
    (3, 'inicio_nosso_numero', 'inicio número'),
    (4, 'nosso_numero', '12'),
    (5, 'demonstrativo', '12'),
    (6, 'instrucoes', 'Instruções aqui'),
    (7, 'agencia', 'Sua agência'),
    (8, 'conta', 'Minha conta'),
    (9, 'conta_dv', 'minha conta');

    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `enderecos`
    --

    CREATE TABLE IF NOT EXISTS `enderecos` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `end_rua` varchar(45) DEFAULT NULL,
    `end_numero` varchar(45) DEFAULT NULL,
    `end_bairro` varchar(45) DEFAULT NULL,
    `cidade_id` int(11) NOT NULL,
    `created` datetime DEFAULT NULL,
    `modified` datetime DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `fk_endereco_cidade1_idx` (`cidade_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;

    --
    -- Extraindo dados da tabela `enderecos`
    --

    INSERT INTO `enderecos` (`id`, `end_rua`, `end_numero`, `end_bairro`, `cidade_id`, `created`, `modified`) VALUES
    (1, 'Matuzalem', '1239-2', 'Casas populares', 1180, '2013-12-22 20:38:04', '2014-06-12 15:53:09'),
    (9, 'asdasdasd', 'dasd', 'asd', 275, '2014-06-12 16:03:27', '2014-06-12 16:03:27');

    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `estados`
    --

    CREATE TABLE IF NOT EXISTS `estados` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `est_sigla` varchar(2) DEFAULT NULL,
    `est_descricao` varchar(45) DEFAULT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=28 ;

    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `financeiros`
    --

    CREATE TABLE IF NOT EXISTS `financeiros` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `valor_total` double NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

    --
    -- Extraindo dados da tabela `financeiros`
    --

    INSERT INTO `financeiros` (`id`, `valor_total`) VALUES
    (1, 109);

    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `fornecedores`
    --

    CREATE TABLE IF NOT EXISTS `fornecedores` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `observacoes` varchar(255) DEFAULT NULL,
    `endereco_id` int(11) NOT NULL,
    `pessoa_id` int(11) NOT NULL,
    `created` datetime DEFAULT NULL,
    `modified` datetime DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `fk_fornecedor_endereco1_idx` (`endereco_id`),
    KEY `fk_fornecedores_pessoas1_idx` (`pessoa_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

    --
    -- Extraindo dados da tabela `fornecedores`
    --


    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `parcelas`
    --

    CREATE TABLE IF NOT EXISTS `parcelas` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `valor` double(8,2) DEFAULT NULL,
    `pago` int(11) DEFAULT NULL,
    `data` date DEFAULT NULL,
    `venda_id` int(11) NOT NULL,
    PRIMARY KEY (`id`),
    KEY `venda_id` (`venda_id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

    --
    -- Extraindo dados da tabela `parcelas`
    --


    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `permissoes`
    --

    CREATE TABLE IF NOT EXISTS `permissoes` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `controle` varchar(100) NOT NULL,
    `permitido` int(11) NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;

    --
    -- Extraindo dados da tabela `permissoes`
    --

    INSERT INTO `permissoes` (`id`, `controle`, `permitido`) VALUES
    (1, 'VendedoresController', 1),
    (2, 'ClientesController', 1),
    (3, 'FornecedoresController', 0),
    (4, 'ProdutosController', 1),
    (5, 'VendasController', 1),
    (6, 'ConfigsBoletosController', 0),
    (7, 'FinanceirosController', 0),
    (8, 'RelatoriosController', 1);

    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `pessoas`
    --

    CREATE TABLE IF NOT EXISTS `pessoas` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `pes_nome` varchar(45) NOT NULL,
    `pes_cpf_ou_cnpj` varchar(45) NOT NULL,
    `pes_telefone` varchar(20) NOT NULL,
    `pes_foto` varchar(100) DEFAULT NULL,
    `pes_sexo` int(11) NOT NULL COMMENT '0 = Masculino, 1 = Feminino',
    `created` datetime DEFAULT NULL,
    `modified` datetime DEFAULT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;

    --
    -- Extraindo dados da tabela `pessoas`
    --

    INSERT INTO `pessoas` (`id`, `pes_nome`, `pes_cpf_ou_cnpj`, `pes_telefone`, `pes_foto`, `pes_sexo`, `created`, `modified`) VALUES
    (1, 'Brendo o Gostosão', '675.616.588-77', '(88)9912-6743', 'uploads/14025841415399bc4d2bc5b.png', 0, '2013-12-22 20:38:04', '2014-06-12 15:53:08'),
    (9, 'Vendedor', '715.832.737-00', '(71)5832-7370', 'uploads/14025890065399cf4ef1dca.jpeg', 0, '2014-06-12 16:03:26', '2014-06-12 16:03:26');

    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `produtos`
    --

    CREATE TABLE IF NOT EXISTS `produtos` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `pro_nome` varchar(45) DEFAULT NULL,
    `pro_preco` decimal(10,2) DEFAULT NULL,
    `pro_quantidade` int(11) DEFAULT NULL,
    `pro_tipo` int(11) DEFAULT NULL COMMENT '0 - comida\n1 - bebida',
    `pro_codigo_barras` varchar(45) DEFAULT NULL,
    `fornecedor_id` int(11) NOT NULL,
    `created` datetime DEFAULT NULL,
    `modified` datetime DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `fk_produtos_fornecedor1_idx` (`fornecedor_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

    --
    -- Extraindo dados da tabela `produtos`
    --


    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `produtos_vendidos`
    --

    CREATE TABLE IF NOT EXISTS `produtos_vendidos` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `quantidade` int(11) DEFAULT NULL,
    `produto_id` int(11) NOT NULL,
    `venda_id` int(11) NOT NULL,
    `created` datetime DEFAULT NULL,
    `modified` datetime DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `fk_produtos_vendidos_produtos1_idx` (`produto_id`),
    KEY `fk_produtos_vendidos_venda2_idx` (`venda_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;

    --
    -- Extraindo dados da tabela `produtos_vendidos`
    --


    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `proprietarios`
    --

    CREATE TABLE IF NOT EXISTS `proprietarios` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `usuario_id` int(11) NOT NULL,
    `pessoa_id` int(11) NOT NULL,
    `created` datetime DEFAULT NULL,
    `modified` datetime DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `fk_proprietario_usuario1_idx` (`usuario_id`),
    KEY `fk_proprietario_pessoas1_idx` (`pessoa_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

    --
    -- Extraindo dados da tabela `proprietarios`
    --

    INSERT INTO `proprietarios` (`id`, `usuario_id`, `pessoa_id`, `created`, `modified`) VALUES
    (1, 1, 1, NULL, '2014-06-12 14:43:28');

    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `usuarios`
    --

    CREATE TABLE IF NOT EXISTS `usuarios` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `senha` varchar(45) NOT NULL,
    `email` varchar(45) NOT NULL,
    `tipo` int(11) DEFAULT NULL COMMENT '0 - proprietário1 - vendedor',
    `created` datetime DEFAULT NULL,
    `modified` datetime DEFAULT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;

    --
    -- Extraindo dados da tabela `usuarios`
    --

    INSERT INTO `usuarios` (`id`, `senha`, `email`, `tipo`, `created`, `modified`) VALUES
    (1, 'j4bnWDPwb+zsQ2ubySGKskxtN0wgTEV2', 'proprietario@live.com', 0, '2013-12-22 20:38:05', '2014-06-12 15:53:09'),
    (7, 'j4bnWDPwb+zsQ2ubySGKskxtN0wgTEV2', 'vendedor@gmail.com', 1, '2014-06-12 16:03:27', '2014-06-12 16:03:27');

    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `vendas`
    --

    CREATE TABLE IF NOT EXISTS `vendas` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `data` date DEFAULT NULL,
    `ven_total` decimal(15,2) DEFAULT NULL,
    `ven_forma_pagamento` int(11) DEFAULT NULL COMMENT '0 - dinheiro\n1 - cartão',
    `vendedor_id` int(11) NOT NULL,
    `cliente_id` int(11) NOT NULL,
    `created` datetime DEFAULT NULL,
    `modified` datetime DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `fk_venda_vendedor1_idx` (`vendedor_id`),
    KEY `fk_venda_cliente1_idx` (`cliente_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

    --
    -- Extraindo dados da tabela `vendas`
    --


    -- --------------------------------------------------------

    --
    -- Estrutura da tabela `vendedores`
    --

    CREATE TABLE IF NOT EXISTS `vendedores` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `ven_rg` varchar(45) DEFAULT NULL,
    `endereco_id` int(11) NOT NULL,
    `usuario_id` int(11) NOT NULL,
    `pessoa_id` int(11) NOT NULL,
    `created` datetime DEFAULT NULL,
    `modified` datetime DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `fk_vendedor_endereco1_idx` (`endereco_id`),
    KEY `fk_vendedor_usuario1_idx` (`usuario_id`),
    KEY `fk_vendedores_pessoas1_idx` (`pessoa_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;

    --
    -- Extraindo dados da tabela `vendedores`
    --

    INSERT INTO `vendedores` (`id`, `ven_rg`, `endereco_id`, `usuario_id`, `pessoa_id`, `created`, `modified`) VALUES
    (7, '715.832.737-00', 9, 7, 9, '2014-06-12 16:03:28', '2014-06-12 16:03:28');

    --
    -- Restrições para as tabelas dumpadas
    --

    --
    -- Restrições para a tabela `cidades`
    --
    ALTER TABLE `cidades`
    ADD CONSTRAINT `fk_cidade_estado1` FOREIGN KEY (`estado_id`) REFERENCES `estados` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

    --
    -- Restrições para a tabela `clientes`
    --
    ALTER TABLE `clientes`
    ADD CONSTRAINT `fk_cliente_endereco1` FOREIGN KEY (`endereco_id`) REFERENCES `enderecos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
    ADD CONSTRAINT `fk_cliente_pessoas1` FOREIGN KEY (`pessoa_id`) REFERENCES `pessoas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

    --
    -- Restrições para a tabela `enderecos`
    --
    ALTER TABLE `enderecos`
    ADD CONSTRAINT `fk_endereco_cidade1` FOREIGN KEY (`cidade_id`) REFERENCES `cidades` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

    --
    -- Restrições para a tabela `fornecedores`
    --
    ALTER TABLE `fornecedores`
    ADD CONSTRAINT `fk_fornecedores_pessoas1` FOREIGN KEY (`pessoa_id`) REFERENCES `pessoas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
    ADD CONSTRAINT `fk_fornecedor_endereco1` FOREIGN KEY (`endereco_id`) REFERENCES `enderecos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

    --
    -- Restrições para a tabela `produtos`
    --
    ALTER TABLE `produtos`
    ADD CONSTRAINT `fk_produtos_fornecedor1` FOREIGN KEY (`fornecedor_id`) REFERENCES `fornecedores` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

    --
    -- Restrições para a tabela `produtos_vendidos`
    --
    ALTER TABLE `produtos_vendidos`
    ADD CONSTRAINT `fk_produtos_vendidos_produtos1` FOREIGN KEY (`produto_id`) REFERENCES `produtos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
    ADD CONSTRAINT `fk_produtos_vendidos_venda2` FOREIGN KEY (`venda_id`) REFERENCES `vendas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

    --
    -- Restrições para a tabela `proprietarios`
    --
    ALTER TABLE `proprietarios`
    ADD CONSTRAINT `fk_proprietario_pessoas1` FOREIGN KEY (`pessoa_id`) REFERENCES `pessoas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
    ADD CONSTRAINT `fk_proprietario_usuario1` FOREIGN KEY (`usuario_id`) REFERENCES `usuarios` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

    --
    -- Restrições para a tabela `vendas`
    --
    ALTER TABLE `vendas`
    ADD CONSTRAINT `fk_venda_cliente1` FOREIGN KEY (`cliente_id`) REFERENCES `clientes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
    ADD CONSTRAINT `fk_venda_vendedor1` FOREIGN KEY (`vendedor_id`) REFERENCES `vendedores` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

    --
    -- Restrições para a tabela `vendedores`
    --
    ALTER TABLE `vendedores`
    ADD CONSTRAINT `fk_vendedores_pessoas1` FOREIGN KEY (`pessoa_id`) REFERENCES `pessoas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
    ADD CONSTRAINT `fk_vendedor_endereco1` FOREIGN KEY (`endereco_id`) REFERENCES `enderecos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
    ADD CONSTRAINT `fk_vendedor_usuario1` FOREIGN KEY (`usuario_id`) REFERENCES `usuarios` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

    Comment

    X
    Working...
    X