Questions tagged as 'join'

1
answer

MySQL JOIN with or without foreign key?

What is the difference between relating 2 tables using and not using a foreign key? Regarding performance, is it advisable to use foreign key to make the relationship? In what situation would it be indispensable and in what situation would...
asked by 28.06.2015 / 06:57
1
answer

Problem with LEFT JOIN using Pentaho Kettle

There is behavior regarding JOIN that I can not understand. I have two tables in these formats Sick Table ID_Doente Doente 1 Pedro 2 Paulo 3 Rui Query table ID_Consulta ID_Doente Tipo 1...
asked by 17.03.2014 / 16:44
6
answers

How to do the following query without using INNER JOIN?

I have table A with the following fields: ID | ID_PAIS_ENVIO | ID_PAIS_RECIBO 1 | 23 | 47 //... I have table B with the following fields: ID | NOME_PAIS 23 | Brasil 47 | Portugal //... I need a query that returns the follow...
asked by 02.07.2014 / 15:50
1
answer

What is the difference between the new JOIN operator and the previous ones?

I was looking at some examples of SQL in Oracle, and I noticed that it's only possible to do JOIN . Example SELECT T1.*, T2.desc FROM table1 T1 JOIN table2 T2 ON T2.id = T1.id_table2 Question What is the differe...
asked by 30.03.2017 / 14:07
2
answers

Use AND within an INNER JOIN can?

I wonder if it is possible to use AND within a INNER JOIN , eg: SELECT * FROM tab1 INNER JOIN tab2 ON tab2.id2 = tab1.id1 AND tab2.camp1 = 'valor' INNER JOIN tab3 ON tab3.id3 = tab2.id2; I gave a rather silly exa...
asked by 10.02.2017 / 14:35
1
answer

Select data from two tables to display in a column?

Consider the tables for the customer registry: Person Table |ID|NOME|TIPO|EMAIL| Physical Table |ID|CPF| Legal person table |ID| CNPJ| inscricao_municipal| inscricao_estadual| My goal is to consult the data of all people,...
asked by 26.01.2016 / 19:20
2
answers

Search performance involving multiple disks

Assuming a query that uses JOIN between two or more tables, such as: SELECT * FROM foo INNER JOIN bar ON foo.id = bar.id Is there performance gain if the data in the tables are in different HD's (due to having more heads reading a...
asked by 22.10.2014 / 22:49
2
answers

Doubt about using the inner join

I have 4 tables in my database Tabela Cadastro - idCadastro(PK) - IP Tabela Porta - idPorta(PK) - numero porta - idSwitch(FK) Tabela Porta_has_Cadastro - idCadastro(FK) - idPorta(PK) //Observação: Relaçao...
asked by 23.10.2015 / 13:51
1
answer

Count in two tables

I'm having trouble counting neighborhood items. I need to list all of the neighborhoods in City X and show the available cars and motorcycles items. In the example I just used a city for easy illustration. I used group by and left join...
asked by 31.01.2015 / 22:38
2
answers

SUM in SELECT with LEFT JOIN being multiplied together

I have 3 tables in MYSQL. Account: id nome 1 caio 2 zé 3 marcelo Followers (the account id, that is, the user has 2 followers): idqual 1 1 2 2 2 3 Products (the account id, that is, the user caio has 3 products): idqual 1...
asked by 21.09.2015 / 21:27