Questions tagged as 'sql'

4
answers

Insert cities into the database

Hello, I am creating a database, and I will have information from Brazilian municipalities, I imagine that I am certainly not the first to need this information, but I am not aware if there is any way to do this automatically, I can download thi...
asked by 05.03.2015 / 13:24
3
answers

Error in a simple SELECT with Group By - SQL Server

I'm trying to do the following SELECT: SELECT P.Nome,P.TipoId,P.QuantidadeMensal FROM StockPhotos.Pacote P GROUP BY P.QuantidadeMensal; However, I'm getting this error message:    Message 8120, Level 16, State 1, Line 2       Co...
asked by 06.08.2018 / 21:39
3
answers

Convert string to MYSQL integer

What command can I use to convert string to integer in mysql? for example: I'm doing the following list of tables: SELECT mov . * , prod.produto, prod.unidade, prod.icms, prod.ipi, prod.codigo FROM movimentacao AS mov, produtos AS prod WHER...
asked by 25.04.2014 / 17:35
3
answers

Transform rows into columns with their respective values

I have the following table idRegistro|Campo |Valor 1 |Nome |Zonaro 1 |Email |[email protected] 1 |campoX|valorX 2 |Nome |Fulano 2 |tel |1188889999 2 |campoY|valorY I need to create a sele...
asked by 17.02.2016 / 14:41
3
answers

Working with ID boundaries in large volumes

I have in mind some questions about large volumes of data in MYSQL , referring to the ID limit. I'll give an ID type tinyint as an example to simplify the explanation. In the example the field tinyint accepts 127 records....
asked by 06.08.2015 / 19:05
2
answers

How to select all id's except one?

Is there any way to in SQL I get all the data except an ID? For example (I know this does not exist in SQL) Select * From Utilizadores Where id_ut != 1;     
asked by 08.09.2015 / 01:31
3
answers

Select Active Lot

I am studying about queries in SQLServer and I have the following scenario: I have a batch table that has the following fields: Lot Table Id INT ProdutoID INT Preco SMALLMONEY Inicio DATETIME Fim DATETIME Product Table (Produc...
asked by 16.08.2017 / 00:15
5
answers

use if on sql server

I have 3 tables in my database, CUSTOMERS, DISTRIBUTORS and EXPORTS and I have a production order table where I get the type of customer (Distributor, customer or export) and the ID of each one. the doubt is: how can I put a if in sele...
asked by 10.06.2016 / 19:21
2
answers

Add date with int

I'm trying to make a sum of days, reported in a int field, with a date field using SQL. I tested the form below, but it adds up to the day, but ignores month and year. Is there any way to do this sum? SELECT DATE_FORMAT(ocorrencias.dt_...
asked by 22.03.2016 / 21:44
2
answers

Updating multiple records at the same time

I have a list with the id and email of each user id email 1 [email protected] 2 [email protected] 3 joao@gmailcom ... How do I set up an sql statement to update all emails at once in my users table? My table: usuarios id...
asked by 08.03.2018 / 15:13