Questions tagged as 'sql'

1
answer

Search for people with similar names

I'm developing a code to search for people's names intelligently using the SQL SERVER LIKE operator. In names like Souza and Sousa, use brackets [] Ex.: select * from pessoas where nome like 'joão sou[sz]a%'; The above example returns me...
asked by 14.03.2018 / 16:11
1
answer

How to create a sequence in varchar in the Postgres database?

I have the following table in the Postgres database: CREATE TABLE customer ( userid character varying(30) NOT NULL, firstname character varying(30) NOT NULL, lastname character varying(30) NOT NULL, balance double precision NOT NULL,...
asked by 21.09.2015 / 20:56
1
answer

How to optimize this query query with other subqueries?

I have a query query that is taking too long to execute (almost 2min) and needs to be optimized: select Cidade.Id as CidadeId, Cidade.Nome as CidadeNome, Cargo.Descricao as CargoDescricao, '{0}' as Grupo, Count(*) as Qtd from Funcion...
asked by 10.09.2014 / 15:58
1
answer

Search in two tables MySQL

Is it possible to give a "select" by merging two tables in MySQL? for example: I have a table named favorites that saves id and strong id . the idea is to go through the favorites table merged with the posts table, (where title, cont...
asked by 10.10.2016 / 17:40
1
answer

What are "columns generated" in MySQL and what would your applications be?

I downloaded the new version of the MySQL workbench and when I was creating a table, I noticed a new field property called Generated Column . On the MySQL site, this is a new implementation of MySQL 5.7.5 , but it has not been very clear to...
asked by 28.05.2016 / 17:18
1
answer

How to group by month with SQL?

I have a table, for example, with an attribute nome and data (for example only). I would like to generate a query that returns the quantity of each row grouped by name and month: Nome Janeiro Fev Março Abril Maio ... João 1...
asked by 15.05.2014 / 22:42
2
answers

SQL Query Optimization in MySQL and Index

I have a performance problem with a query with SQL on MySQL that is using my server a lot, I have done index and even then the consumption does not decrease. The query I'm using is: SELECT CONCAT( '2015-10-14 '...
asked by 14.10.2015 / 15:52
1
answer

SQL Server Data Dictionary

Hello, I come from the Oracle culture and I want to learn a little bit of SQL Server, I'm having trouble finding the SQL Server data dictionary, I've already looked at other forums and found nothing. In Oracle we have a data dictionary that s...
asked by 20.05.2018 / 01:58
1
answer

Is it possible to use timestamp without having to convert to String in Oracle?

I have a query that one of your filters is a date, is it possible to filter in Oracle with something like this? SELECT * FROM tabela WHERE campoData = '2014-02-10 15:56:00.000' Or do we always have to convert to String as below? SELECT *...
asked by 10.02.2014 / 18:57
2
answers

I can not put a subquery inside the IN in PIVOT

Below is the code for creating the table and inserting some data for testing. CREATE TABLE [dbo].[tb_empresas]( [data] [date] NULL, [nome] [varchar](100) NULL, [valor] [decimal](18, 2) NULL ) ON [PRIMARY] INSERT INTO tb_empresas (data, nome,...
asked by 10.03.2014 / 15:29