Questions tagged as 'sql'

1
answer

Track store inventory

I'm in a virtual store project and I have a question about the stock control process. Initially I'm doing everything in the product table where I have two fields: manage_stock and stock . Manage Stock will control whether...
asked by 29.05.2016 / 16:39
2
answers

Syntax error when using UNION [closed]

Error: /* Erro SQL (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM pedido a, tipofornecimento b ' a...
asked by 26.10.2015 / 18:32
1
answer

Check if value is in a column

I need to check if a value is in a column in the DB. My column has the content separated by commas, like this: 1,2,3,4,5. So, I would like to know how to check if value 2, for example, is in some row in the SQL column.    Select everything fr...
asked by 16.08.2018 / 22:49
1
answer

Create Table in SQL Server 2008

It is possible to create a CAIXA table which, for example, when putting CODIGO of product, pull DESCRIÇÃO automatic, being in the PRODUTOS ?? table     
asked by 08.03.2016 / 19:01
3
answers

Update in same table

I have this table like this: CODIGO_AULA DATA_AULA TURMA ----------- ---------- ---------- 1 2018-01-19 MEC-001 2 2018-01-19 MEC-001 1 2018-01-20 MEC-001 2 2018-01-20 MEC-001 1 2018-01-21 ME...
asked by 22.01.2018 / 18:02
1
answer

Performance query slow

I have a database that has about 3 teras and I'm having trouble optimizing some querys. In this example I have 3 tables: Assembler, Car and model. And I have this query that takes about 30m, all the inner joins are indexed and the query wa...
asked by 04.12.2018 / 23:11
1
answer

Basic report through SQL

Good afternoon, I am doing an evaluation questionnaire system, where you have several questionnaires with several questions that refer to a questionnaire, which can be opened or closed. In the response table where I'll pull reports, it works...
asked by 30.05.2018 / 21:34
2
answers

Difficulties in making select

I'd like some help on how to solve the last 3 selects below. Rememberingthatthereportsthatcontaintheitem"Total quantity" require the total quantity of the product taking into account all the requests made. SELECT pedido.horario_pedido AS h...
asked by 19.12.2017 / 21:44
1
answer

Problem in Creating Tables

I'm trying to create a table, and I can not seem to find the error in its creation: CREATE TABLE Beneficiarios ( Ano year(4), Homens number(4), Mulheres number(4) );     
asked by 12.07.2017 / 10:07
1
answer

How to validate some fields in SQL [duplicate]

I have the following SQL $contarperfilclienteinsuficiente = "0"; $sqlxmlperfilclienteinsuficiente = "select COUNT(CASE WHEN tipo = 0 THEN 1 ELSE NULL END), COUNT(CASE WHEN tipo <> 0 THEN 1 ELSE NULL END) from clientes where...
asked by 15.03.2016 / 15:04