Questions tagged as 'sql'

1
answer

How to remove duplicate lines efficiently?

I'm normalizing a table here and found that there are duplicate rows. The way I chose to clean these lines is through: CREATE TABLE tabela_nova AS ( SELECT DISTINCT * FROM tabela_antiga ); The problem this way is that it is very slo...
asked by 10.06.2015 / 01:56
1
answer

Finding Unknown Heroes in Stack Overflow using Data Explorer

I know there are no Unknown Hero here in SOPT, but I know there are several not SOEN. My intention is to rank the percentage of votes accepted without the votes of the people holding this medal. And so I tried to create a SQL for Data Explore...
asked by 18.08.2014 / 23:12
2
answers

Error trying to update table using C #

I created a form to change a table, but my update is not working. cnxCli.sel =/*"set dateformat dmy \n"+ */ "update Cliente" + "set Nome = '" + txtNome.Text +"'," + "Rg = '" + mskRg.Text +...
asked by 16.12.2015 / 02:32
5
answers

How to erase data from a table with dependencies in other tables

I need to delete data from a table that has dependencies on other tables. For example so that I can delete a data from the person table first I have to delete a dependency that exists in the credential table which in turn has dependency on anoth...
asked by 29.09.2014 / 23:41
2
answers

Function equivalent to "DISTINCT ON" in Oracle DB?

In Postgres, you can have distinct apply to just 1 field of the select using DISTINC ON , how can I reproduce this function in an Oracle database? Here is an example query: SELECT DISTINCT ON (CITY) CITY, STATE, ZIPCODE, ROW_ID FROM d...
asked by 23.12.2014 / 20:19
2
answers

In SQL queries should I follow the index order?

If in my table X is created an index with fields A, B and C (in this order), in SQL queries should I follow exactly that order? Example following the order of the index: SELECT * FROM X WHERE X.A = VALOR_A AND X.B = VALOR_B AND X.C =...
asked by 04.07.2018 / 19:40
3
answers

Changing the data type of a sql column

Good morning. I have the CliTelCel char(10) column in the Clientes table, I need to change char(10) to char(11) . But this column already exists data, what would be the best way to proceed in this case, without losi...
asked by 18.05.2017 / 14:47
1
answer

What is the given name for the number of columns in a table?

What is the given name for the number of columns in a table? And the name for the number of rows?     
asked by 07.06.2017 / 19:05
3
answers

Should log tables have Foreign Keys?

I had a case in my service on those days when it was not possible to delete a record because it was referenced by the log table. Of course, that has generated a call for IT to solve. But such a case made me think. Although by default I...
asked by 12.08.2016 / 17:03
5
answers

Separate ddd from phone with SQL statement

I have a table with DDD and Phone fields. Some have been registered correctly, others ddd is next to the phone and I need to separate. TABLE +--------------------+ | DDD | Telefone | +--------------------+ | 47 | 89876543...
asked by 10.12.2015 / 16:29