Questions tagged as 'sql'

1
answer

What's the difference when using binary in the where clause?

What is Binary and what does it do? What is the difference generated when using Binary in a query in MySQL and when not using Binary ? SELECT email, senha from login WHERE usuario = ? && senha = ? SELECT email,...
asked by 19.05.2017 / 15:26
1
answer

Redeem all nodes in a SQLite database tree

I have a serialized tree in my database in the arvore table. Like every good tree, every node can have at most one single parent node. Your data is in this format: id | id_pai | valor ---+--------+------ 1 | | 'pai de todos' 2...
asked by 22.06.2017 / 13:29
1
answer

Use IN or multiple ORs? Which one has the best performance?

I have the following queries in MySQL: 1st: Using multiple OR SELECT SUM(qtd) FROM produtos WHERE qtd > 10 and (status = '0' or status = '4' or status = '7') 2nd: Using IN SELECT SU...
asked by 06.07.2017 / 15:45
1
answer

Where Mysql search for complete word

I have a database and would like to know how do I search for the data by typing the complete result using where Example: ID NOME CODIGOS 1 | Joao | 9714,51,100 2 | Maria | 50,9714,88100 I wanted to make it return a where by search...
asked by 29.04.2018 / 18:27
2
answers

How do I get the names of all PostgreSQL database tables?

How to get the names of all PostgreSQL database tables? How to get the attributes (code, name, etc ...) of a given table in the PostgreSQL database?     
asked by 07.02.2017 / 19:20
2
answers

Is it possible to limit the amount of rows of a class attribute that is a list via JPQL?

I have the following query in JPQL FROM User u INNER JOIN FETCH u.enderecos e WHERE u.id =:id ORDER BY e.id DESC A user can have more than ten addresses, so we want to bring only ten addresses and if the user wants, he loads ten times. I...
asked by 25.08.2014 / 19:58
3
answers

Retrieve longer and shorter time-bound dates

Within a table containing the data_inicio , data_fim , hora_inicio , hora_fim columns, you need to identify the following occurrences within a recordset: the lower start date, the higher end date, the start time lower an...
asked by 06.05.2015 / 22:30
2
answers

Mysql - make each line increment 1

I want to make a query sql and I want each line to have a column indicating the line number eg: linha nome 1 joao 2 maria 3 tiago . . . . . . n joares But, this column "li...
asked by 22.05.2015 / 22:44
2
answers

Concatenate table name loop sql server

I'm trying to populate a table of my with a loop in sql server follow the code: declare @i int set @i =1 while @i < 5 begin INSERT INTO TABELA VALUES('teste') set @i = @i + 1 end I would like to concatenate the name of the table in the...
asked by 04.07.2014 / 16:40
1
answer

Practically speaking, is it good to use Self Join?

Regarding this question: What is a "self join" , technically speaking it is performative to do this, or use 1N, 2N and 3N (normal forms) is the best way? Just remembering that I have never stated that one breaks rule of the other, it is pure...
asked by 01.07.2014 / 15:16