Questions tagged as 'sql'

1
answer

Filter using calculated value does not work in Django

I have a template in Django with fields largura and comprimento , and I would like to filter it by area: class Projeto(models.Model): largura = models.DecimalField(decimal_places=0, max_digits=4, default=0) comprimento = m...
asked by 07.04.2016 / 15:42
2
answers

Duplicate value in the table. How to remove?

I inserted a TSE tables into my database and have duplicate values from the SQ_CANDIDATO column representing the image placed above. How can I do a maintenance with sql that will remove ALL ID ? ... Leave only one SQ_CANDID...
asked by 06.03.2015 / 04:36
2
answers

How to create this rule in mySQL

I have a field in my table: tipoEndereco char(1); However this field only receives two possible values, which are: 1-> i (Instalação) 2-> c (Cobrança) Because of this, I'm thinking, and I would like your opinion, to change i...
asked by 17.09.2015 / 15:53
1
answer

Is there a way to name the selected tables in a stored procedure to identify them in the DataSet?

I have a Store Procedure in SQL Server that projects multiple data. Example: CREATE PROCEDURE [dbo].[teste_sp] AS BEGIN select * from compra select * from cliente select * from fatura END However, when retrieving the DataSet in...
asked by 18.12.2015 / 18:02
1
answer

Table Update in PostGreSQL

I have the following question in Java: how can I pass to SQL that it should capture the "date and time" of the computer and update the User Table in PostGreSQL? Follow the code below: public class UsuarioAtualizar { private Connection...
asked by 29.11.2015 / 15:18
1
answer

Calculating hours within the query

I've already done this and it works fine in C ++. My problem is to do within a select to appear in the table. If anyone wants to see the algorithm in C ++ to help mount it in MySql I can. My table is this: The fields after the stat...
asked by 01.01.2017 / 19:46
1
answer

Convert SQL query to LINQ

What would be the converted SQL query for LINQ: "SELECT SUM(valor_negocio) valor_negocio, " + " MONTHNAME(STR_TO_DATE(MONTH(data_inicio), '%m')) mes," + " STATUS" + " FROM negocio" + " WHERE data_inicio BETWEE...
asked by 04.11.2017 / 20:26
2
answers

Execute SELECT within a CASE

I am using php to make a SELECT of the database, however I need to select check if one of the fields has been filled in and, if so, execute a new SELECT of another table. Basically the idea is that I have a coupon...
asked by 14.07.2016 / 16:25
0
answers

Doubt implementation SQL database [closed]

I am creating a product control of a company, in which we need to generate sequential codes for products as they are registered, we sell digital products, so there is no physical quantity. At first I thought of using a field of auto increment, b...
asked by 15.09.2016 / 00:48
1
answer

How can I prevent the deletion of relational data through referential integrity in MYSQL?

I have the SIMULATE and QUESTION tables, where a simulation can have several questions, but one question can only be for a simulated (1-n relationship). SIMULATED TABLE: simuladoId simuladoNome QUESTION TABLE questaoId questaoPergu...
asked by 14.09.2016 / 17:37