Questions tagged as 'sql'

1
answer

inner join table on 1 = 1 can be considered a gambiarra?

I have a table of provas and a table of alunos that have no direct relationship, I still have a inscrição aluno table and a escolas table, as follows in the modeling below: Ineedtocreateaselecttobringhowmanystudents...
asked by 02.06.2015 / 15:26
3
answers

Firebird suspend function

What is the role of suspend in a procedure in Firebird?     
asked by 18.07.2014 / 23:12
1
answer

How to configure an existing field for auto-increment?

I would like to set the id field already created as auto-increment, because I created the table and did not put this option for it, how could I do this?     
asked by 25.02.2016 / 15:53
1
answer

Condition in MySQL in data query

Is there any way to do a condition to show data only if the status is as aprovado in the database? MySQL: Nome ProdValor Data Status Goku 250,00 15/04/2015 Aprovado Goku 250,00 15/04/2015 Pendente...
asked by 16.04.2015 / 03:31
4
answers

How to bring a specific result from one SQL query above the others?

I have the following SQL query: SELECT DISTINCT 'user_id' AS 'id', 'user_name' AS 'name' FROM 'users' ORDER BY 'id' ASC; That generates output: +----+--------+ | id | name | +----+--------+ | 1 | Calebe | | 2 | João | | 3 | Lucas...
asked by 03.02.2014 / 00:24
1
answer

Restrict a character limit array in LIKE

I have a question about LIKE of T-SQL. Is it possible to restrict by a number of equal characters to check how many addresses start the same and may end up different? More or less like this: Where Endereco LIKE '[array10caracteres]%'...
asked by 25.11.2014 / 12:29
1
answer

Do Select with value lookup in another table

I have a table with foreign key fields, and would like to return a select value of the item to the key. For example, I have the following table formed with the query: SELECT cod_produto, MQ1FK, MQ2FK, MQ3FK, MQ4FK, MQ5FK FROM engenha...
asked by 17.11.2014 / 18:47
1
answer

SQL query doubt [closed]

I've seen the following expression in an sql video: (union select 1,2,3 ) What does it mean? link video: link     
asked by 06.02.2016 / 00:32
1
answer

Viewing Query History in Sql Server Management Studio

I'm trying to retrieve queries I've made in Sql Server Management Studio 2014, I know there's a simple history feature in Heidi Sql, I'd like to know if Sql Server Management Studio 2014 has the same functionality.     
asked by 25.01.2016 / 17:11
2
answers

How to return an int in a Decimal property

I have a SQL string (made by another programmer a long time ago so I can not change it) which returns something like this: If it has value in the column, it returns the value, otherwise it returns 0 (I would post the SQL here but it's gigantic.)...
asked by 01.07.2014 / 15:41