Questions tagged as 'sql'

1
answer

What is the difference between a single quote and a double quotation mark in SQL?

Context When I do a SQL and I want a specific alias I should enclose double-quotes ". SELECT A.ds_nome_pessoa AS "Pessoa.nome" ... When I want to make a where in of a field varchar the values must be in single quotation ma...
asked by 25.01.2016 / 12:21
5
answers

MySQL Limit Equivalent in SQL Server

Does anyone know how to relate the differences between MySQL and SQL Server, including using LIMIT n,n ? Or if they have a link that lists the differences would be cool. Example SELECT * FROM tabela LIMIT 50, 100 What would be the...
asked by 26.03.2014 / 17:01
2
answers

Why use WHERE 1 = 1 in a SQL query?

During the maintenance of a legacy system I noticed the following procedure : DECLARE @sql AS varchar(MAX); DECLARE @param as varchar(50); SET @sql = 'SELECT * FROM Destinatario where 1 = 1'; IF(@param IS NOT NULL) SET @sql = (@sql + '...
asked by 10.04.2014 / 18:53
1
answer

What is the difference between ISNULL and COALESCE in a search?

I'm not sure how to use ISNULL and COALESCE . Currently when I create a query in SQL Server, I have doubts about ISNULL and COALESCE , I did some research and I was able to discover the difference of both. Only tha...
asked by 25.03.2015 / 15:56
6
answers

How to SELECT all but a few fields?

It is well known ( and has already been asked ) you should avoid using SELECT * in some cases in queries to the bank. But imagine that I have a table with 50 columns, and I want to select 40 of them. Just selecting the fields would alr...
asked by 30.06.2014 / 15:58
4
answers

Why are NULL values not selected?

When doing a select, I noticed that data with NULL field is not retrieved using the <> operator. Why does this happen? NULL is equal to char N ? Notice that in the query below only the first row is r...
asked by 17.09.2015 / 19:55
1
answer

How to document codes in SQL?

When I write code in R, the correct way to document is in the code itself, in the form of comments started with a special mark #' . #' Add together two numbers. #' #' @param x A number. #' @param y A number. #' @return The sum of \code{...
asked by 19.12.2016 / 13:10
3
answers

Is the SQL language object-oriented?

Is the SQL language object-oriented? If so, could you show an example?     
asked by 24.07.2017 / 13:12
3
answers

SQL in the code or in the database?

I have a big question as to where to put my query SQL, whether in the code or the bank . I currently have a procedure that is set up according to the parameters I have, ie filtros . Procedure @escopoVerificacao varchar(MAX) =...
asked by 24.02.2015 / 21:20
4
answers

Return all equal items from different groups

------------------- - TABLE - ------------------- ID | GRUPO | OBJETO ---|-------|------- 1 | 1 | 1 2 | 1 | 2 | | 3 | 2 | 1 4 | 2 | 2 | | 5 | 3 | 1 6 | 3 | 2 7 | 3 | 3 | | 5...
asked by 03.09.2015 / 09:53