Questions tagged as 'query'

1
answer

How do I extract the values of an Expression?

Hello. Is it possible to extract from an Expression what filters, computers, etc. were used in a query? Example: public class Program { class Produto { public int Id; public string Nome; public Produto(int i...
asked by 06.10.2015 / 22:15
1
answer

How to apply the IF ELSE condition to the selection of a column?

In MySQL, I have an old table entities where the gender column is formatted as ENUM , containing values of type "i", "m", "f". When migrating this data to the new structure of this table, I wanted to run a query on the database...
asked by 17.12.2013 / 13:42
2
answers

How to get the current year in ORACLE?

I need to get the annual year in ORACLE, but I just know how to get the current date, like this: SELECT SYSDATE FROM DUAL Can you manipulate this to get the Year?     
asked by 27.02.2014 / 19:27
2
answers

LIKE query performance in MySQL

Is there any way to increase the performance of a query with LIKE '%string%' in MySQL? I know that if LIKE is 'string%' , it is faster. The problem is when % is at the beginning of the string. Is there some sort of...
asked by 13.08.2014 / 03:33
3
answers

_ (underline) in consultation with LIKE

I'm doing a query where I need to return all the information in a given table, which contains " _R _ " in the nomenclature. However, when using WHERE NM_CAMPAIGN LIKE '%_R_%' it returns me to other cases that only have " R _ ". How...
asked by 16.08.2017 / 14:55
1
answer

Problems with a MYSQL query - Categories and Items

I'm doing a project, which basically consists of item and category ... or rather "animes" and "episodes" ... Here's the problem, I want to list all the registered anime and a count of episodes related to them, for example. "Katekyo - 24 episo...
asked by 27.02.2015 / 17:48
1
answer

How to get the last record entered in SQL according to your date

I need to get a record of a table, where this record is what the date was entered last. Of the genre: SELECT Ped.Quantidade FROM ped WHERE data <= @data But as I have several records it returns me all, when I just want the last one in...
asked by 16.04.2014 / 13:44
2
answers

Full Join N-N without repeating records

I have two tables with relation N-N: ITEM_ORC ITEM_COMP | OP | Item Orçado | | OP | NF | Item Comprado | +-------+------------------+ +-------+---------+------------------+ | 1...
asked by 23.04.2015 / 15:03
1
answer

SQL Server JOINS vs Subquerys

I was doing some queries, and there was a need to perform grouping of a table that was in a JOIN within the query. For example. Sales table. +----+---------+------------+----------+ | Id | Cliente | Data | Vendedor | +----+---------...
asked by 20.03.2018 / 22:13
1
answer

Why should we use "IS NOT NULL" instead of "NULL"?

I always asked myself this: Why should we use IS NOT NULL instead of <> NULL ? For when I do as in the second case, no result is found. Example: SELECT * FROM tabela WHERE campo IS NOT NULL Displays all rows, except wh...
asked by 18.08.2015 / 22:24