-
Similar Content
-
By Quencyjones79
Olá a todos, sou novo na área de multimídia. Estou a seguir a um momento um ebook sobre a criação de uma base de dados e também a criação de tabelas. Mas quando vinculei as tabelas do banco de dados, no phpmyadmin me deu alguns erros. Fiz a correspondência da chave primária (artist_id da tabela Artist) com a artist_id da tabela Prints (chave estrangeira) e assim por diante. O problema é que ele não mostra minhas relações das tabelas e me dá uma mensagem de erro. Então, alguns de vocês poderiam me ajudar, por favor, a consertar esta situação. Eu serei grato. Cumprimentos.
Ps .: Abaixo envio o arquivo Sql.
Atentamente,
José Moreira
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jan 07, 2021 at 08:49 PM -- Server version: 10.4.14-MariaDB -- PHP Version: 7.2.33 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!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 */; -- -- Database: `ecommerce` -- -- -------------------------------------------------------- -- -- Table structure for table `artists` -- CREATE TABLE `artists` ( `artist_id` int(10) UNSIGNED NOT NULL, `first_name` varchar(20) DEFAULT NULL, `middle_name` varchar(20) DEFAULT NULL, `last_name` varchar(40) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `customers` -- CREATE TABLE `customers` ( `customer_id` int(10) UNSIGNED NOT NULL, `email` varchar(60) NOT NULL, `pass` char(40) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `orders` -- CREATE TABLE `orders` ( `order_id` int(10) UNSIGNED NOT NULL, `customer_id` int(10) UNSIGNED NOT NULL, `total` decimal(10,2) UNSIGNED NOT NULL, `order_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `order_contents` -- CREATE TABLE `order_contents` ( `oc_id` int(10) UNSIGNED NOT NULL, `order_id` int(10) UNSIGNED NOT NULL, `print_id` int(10) UNSIGNED NOT NULL, `quantity` tinyint(3) UNSIGNED NOT NULL DEFAULT 1, `price` decimal(6,2) UNSIGNED NOT NULL, `ship_date` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `prints` -- CREATE TABLE `prints` ( `print_id` int(10) UNSIGNED NOT NULL, `artist_id` int(10) UNSIGNED NOT NULL, `print_name` varchar(60) NOT NULL, `price` decimal(6,2) UNSIGNED NOT NULL, `size` varchar(60) DEFAULT NULL, `description` varchar(255) DEFAULT NULL, `image_name` varchar(60) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; -- -- Indexes for dumped tables -- -- -- Indexes for table `artists` -- ALTER TABLE `artists` ADD PRIMARY KEY (`artist_id`), ADD UNIQUE KEY `full_name` (`last_name`,`first_name`,`middle_name`); -- -- Indexes for table `customers` -- ALTER TABLE `customers` ADD PRIMARY KEY (`customer_id`), ADD UNIQUE KEY `email` (`email`), ADD KEY `login` (`email`,`pass`); -- -- Indexes for table `orders` -- ALTER TABLE `orders` ADD PRIMARY KEY (`order_id`), ADD KEY `customer_id` (`customer_id`), ADD KEY `order_date` (`order_date`); -- -- Indexes for table `order_contents` -- ALTER TABLE `order_contents` ADD PRIMARY KEY (`oc_id`), ADD KEY `order_id` (`order_id`), ADD KEY `print_id` (`print_id`), ADD KEY `ship_date` (`ship_date`); -- -- Indexes for table `prints` -- ALTER TABLE `prints` ADD PRIMARY KEY (`print_id`), ADD KEY `artist_id` (`artist_id`), ADD KEY `print_name` (`print_name`), ADD KEY `price` (`price`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `artists` -- ALTER TABLE `artists` MODIFY `artist_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `customers` -- ALTER TABLE `customers` MODIFY `customer_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `orders` -- ALTER TABLE `orders` MODIFY `order_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `order_contents` -- ALTER TABLE `order_contents` MODIFY `oc_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `prints` -- ALTER TABLE `prints` MODIFY `print_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; COMMIT; /*!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 */;
-
By RodrigoWD3
Ola boa tarde, não sei se aqui e o tópico correto , tenho uma tabela de vendas , id , nome, id_vendedor (essa id identifica o vendedor)
ID | produto | | id_vendedor |
1 | computador x | | 2 |
2 | computador x | | 2 |
3 | computador x | | 2 |
4 | Mouse | | 1 |
Como faço para ordenar da seguinte forma. Quero contar quantas vezes o produto foi repetido, e ordenar pelo numero de repetições na tabela SQL se alguém souber obrigado
-
By Claudio Neto
Boa noite
Fiz meu primeiro projeto .Net Core, e está tudo funcionando que é uma belezinha.
Porém, ao publicar a aplicação no IIS, não estou conseguindo conectar no banco de dados. As páginas que não possuem conexão funcionam.
Quando publiquei, ele gerou três arquivos json de configuração: appsettings.json, appsettings.Development.json e appsettings.production.json, e dentro de cada um dele, tem a conexão que eu criei e ele inseriu mais uma:
"ConnectionStrings": { "HoleriteContext": "Server=DESKTOP-DGCC9GF\\SQLEXPRESS;Database=HOLERITES;Trusted_Connection=True;MultipleActiveResultSets=true;user id=sa;pwd=123;", "prjHoleriteContextConnection": "Server=(localdb)\\mssqllocaldb;Database=prjHolerite;Trusted_Connection=True;MultipleActiveResultSets=true" } Eu tentei copiar a string de conexão de HoleritesContext para prjHoleriteContextConnection, mas não deu em nada.
Meu banco já está configurado para aceitar conexões TCP. E o erro está dando tanto na minha máquina local quanto no servidor do cliente.
Não consegui encontrar algum tutorial que fale sobre essa parte, então alguém pode me auxiliar onde estou errando?
Obrigado.
-
By adrianno
Boa noite, tenho a seguinte questão, tenho uma tabela com campo "valor" que guarda um valor monetário e campo "data" com a data do lançamento e um campo "tipo" marcando se é entrada ou saida, ao cadastrar um valor, coloco a data e qual tipo "entrada" ou "saida" quero montar uma view que soma todos os valores por mês, separados por tipo, se é entrada ou saida. A seguinte query me tras a soma, porém não agrupa pelo MES/ANO
SELECT DATE_FORMAT(data, "%m/%Y") as MES, (select Sum(valor) from controle WHERE tipo = 'SAIDA' ) as VS, // soma tudo que for SAIDA (select Sum(valor) from controle WHERE tipo = 'ENTRADA' ) as VE // soma tudo que for ENTRADA FROM controle GROUP BY YEAR(data), MONTH(data) // agrupa por ANO/MES mas este grupo nao opera nas somas dos valores ORDER BY data DESC Esta query somas os valores mas não filtra pelo mes/ano e tras a soma total de tudo ignorando o mes, mostra o mesmo valor total de cada tipo em todos os meses:
EXEMPLO DO RESULTADO
MES VS(saida) VE(entrada)
06/2020 4600,00 9750,00
05/2020 4600,00 9750,00
04/2020 4600,00 9750,00
Na prática cada mês deveria retornar as somas dos valores apenas dele. Como fazer com que GROUP BY YEAR(data), MONTH(data) tenha efeito correto em cada tipo?
-
By skiterfly
Procurei muito na internet e inclusive aqui no forum, mas não encontrei nada sobre como usar uma tabela do google (google sheets) para expor os dados em meu site. Alguem pode me ajudar? (31) 991579687.
-