Questions tagged as 'sql'

0
answers

How index selectivity works

Reading about indexes I recently came across the term "selectivity". Some places said that more selective fields should come first in the index, others say no or that it depends. I have the following table tbMovimentoConta abbreviation...
asked by 11.01.2017 / 17:25
1
answer

ORDER BY only day without time

In MySQL I have a column timestamp called dia_cadastr o (2016-06-21 11:27:32), in the query I want to give a ORDER BY only on the day, and disregard the time. That is, if they have products registered the same day, then it g...
asked by 24.06.2016 / 15:07
3
answers

Convert date of type 2016-10-04 15:51:16 to, 04-10-2016 15:51:16 in SQL or PHP how to do?

I am doing a job to show the date and time of the insertion in the script in the database, I have to show the date in dd-mm-yyyy format and then the time, how can I do this by the SELECT of the script or by the PHP? If so, how can someone help m...
asked by 10.10.2016 / 16:58
1
answer

Differences between Natural Join and Inner Join

What characteristics differentiate a query performed using Natural Join from another with the use of Inner Join ? Is there any performance related question or any other condition that leads me to choose one over the other? For th...
asked by 21.03.2015 / 15:53
2
answers

What is the difference between Function and Procedure?

What are the differences between the two, and examples of where they are usually used.     
asked by 27.04.2015 / 20:30
2
answers

READPAST and NOLOCK What are they?

What is READPAST and NOLOCK ? I have seen quite a lot of the use of NOLOCK , but READPAST saw use now, pretty much the same way, ie. FROM dbo.table t WITH(READPAST) and FROM dbo.table t WITH(NOLOCK) But wh...
asked by 31.08.2017 / 19:55
4
answers

Calculate Total Hours, identifying equal time intervals

After breaking my head a little, I ask you to help me in the following situation: I have a problem in SQL (Sql Server 2005) of time calculation; Basically I have to calculate the sum of hours worked on technical drives. The issue is that a...
asked by 06.03.2015 / 15:41
1
answer

Make truncate all tables in a database in MySQL

Is there a way to use TRUNCATE to clear all tables in the database? TRUNCATE tabela; This command clears one by one.     
asked by 10.03.2015 / 19:38
2
answers

How to do similar word searches in SQL?

Let's suppose I have the following data in a table:    John       Pedro       Ronaldo       Luiz If I use a query %like% it finds the user typing strictly. For example, if he types ron he finds Ronaldo . But if he t...
asked by 02.06.2014 / 13:40
4
answers

Mounting run-time updates

When mounting SELECTS at runtime we always have the problem of knowing what might be coming or not depending on the choices made by the user. When assembling the WHERE clause we are faced with the question of adding AND o...
asked by 27.05.2016 / 19:46