Questions tagged as 'sql'

2
answers

Problem with dates in PostgreSQL

I have this query below and I want the faturamento , ticket_medio and qtd_pecas , qtd_atendimentos , to be divided by the numbers on Tuesdays. Example had 5 Tuesdays with values registered in this view, I want it to be d...
asked by 10.08.2017 / 17:40
0
answers

How to filter list of active clients in a given period [closed]

Good morning, everyone. I am developing a management software for a home care company. I have a list of clients that may be active or inactive within a given month. Each customer has a contract value with the company and costs it generates each...
asked by 11.09.2017 / 12:49
1
answer

Backup Database - error in SQL Syntax

I am building a button to back up my db via C# application, is running fine, however at the time of applying ExecuteNonQuery is accusing% error of%. Follows: Designate Path: private void Browser_Click(object sender, Eve...
asked by 23.08.2017 / 18:51
8
answers

Why is "SELECT * FROM table" bad?

It is often said that getting all the columns of a table through the SELECT * FROM tabela command is bad practice. Any recommendations without explanation are not helpful. So ... If it is bad practice, there must be a way to use it pro...
asked by 16.06.2014 / 21:26
0
answers

Help to optimize an index in mysql

I have a relationship website and for years I've tried to optimize this query. Almost every day the site hangs because of it. User table structure CREATE TABLE 'usuarios' ( 'id' bigint(20) NOT NULL, 'nome' varchar(25) CHARACTER SET utf8...
asked by 26.07.2017 / 07:48
1
answer

Divide date range in weeks

It would have some simple way of extracting the weeks given a range of dates, for example: start date: 07/01/2017 end date: 7/30/2017 Given the dates above how could you automate the extraction of the weeks contained in this range? E...
asked by 20.07.2017 / 18:12
4
answers

Type of the CPF or CNPJ field in the VARCHAR or INT database?

What type of CPF or CNPJ field in database VARCHAR or INT ? I've seen some posts suggesting to use INT to optimize performance in JOIN and filters. If you have 0 on the left, you can only complete it according...
asked by 22.01.2015 / 14:51
1
answer

Error in insert MSQLI [closed]

I am changing from mysql_ to mysqli, everything works (update and delete) more in the insert does not save .... where is the error? insert file: include("config/con_mysqli.php"); $sigla = $_REQUEST['sigla']; $nome...
asked by 19.07.2017 / 14:22
3
answers

Select that respects all values in a list

I need to mount a very simple select, but I'm having trouble. SELECT SEQPRODUTO FROM MRL_PRODUTOEMPRESA WHERE STATUSCOMPRA = 'I' AND NROEMPRESA IN (1,2,3,4,5,6,7,8,9,11,13,14) I need to select the products where STATUSCOMPRA = 'I'...
asked by 15.08.2017 / 21:43
1
answer

System.NullReferenceException: Object reference not set to an instance of an object

I'm developing a project in asp.net, where I'm trying to do this insertion in the database. But when I try to perform this command, it ends up saying this error message: "System.NullReferenceException: Object reference not set to an instance of...
asked by 14.07.2017 / 19:25