1
As that puts the idautor and idobra in this my SELECT:
CREATE TABLE Obra_Assunto (
idassunto INTEGER NOT NULL,
idobra INTEGER NOT NULL,
PRIMARY KEY (idassunto, idobra),
FOREIGN KEY (idobra)REFERENCES Obra (idobra),
FOREIGN KEY (idassunto)REFERENCES Assunto (idassunto)
);
CREATE TABLE Obra_Autor (
idobra INTEGER NOT NULL,
idautor INTEGER NOT NULL,
PRIMARY KEY (idobra, idautor),
FOREIGN KEY (idobra)REFERENCES Obra (idobra),
FOREIGN KEY (idautor)REFERENCES Autor (idautor)
);
CREATE TABLE Assunto (
idassunto INTEGER NOT NULL,
descricaoAssunto VARCHAR(50) NOT NULL,
PRIMARY KEY (idassunto)
);
CREATE TABLE Autor (
idautor INTEGER NOT NULL,
nomeAutor VARCHAR(50) NOT NULL,
PRIMARY KEY (idautor)
);
CREATE TABLE Obra (
idobra INTEGER NOT NULL,
titulo VARCHAR(50) NOT NULL,
ano_publicacao INTEGER NOT NULL,
quantidade INTEGER NOT NULL,
ideditora INTEGER NOT NULL,
PRIMARY KEY (idobra),
FOREIGN KEY (ideditora)REFERENCES Editora (ideditora)
);
select nomeAutor,titulo,descricaoAssunto
from autor a , obra_autor oa , obra o , obra_assunto os, assunto ass
Where a.idautor= oa.idautor AND oa.idobra= o.idobra AND o.idobra= os.idassunto AND os.idassunto= ass.idassunto;
just put
select o.idobra, a.idautor
... group by you only use when working with aggregation function– Rovann Linhalis
Good morning, as well as aggregation function ?
– Futebol Arts Variados
aggregation functions:
max
,sum
,min
,avg
among others....– Rovann Linhalis
But like this, it only goes for two tables ?
– Futebol Arts Variados
hi ? read / watch: https://www.devmedia.com.br/sql-funcoes-de-agregacao/38463
– Rovann Linhalis
But in a table only is simple, I want to know how it does in several tables ?
– Futebol Arts Variados
similarly... 1 or n tables, only changes the joins, what you do with the columns, is the same... the answer of lacobus worked ?
– Rovann Linhalis
gave yes , including good response.
– Futebol Arts Variados
then mark it as the answer to the question, and if it is valid, rate it as +1
– Rovann Linhalis
access the [Tour] please
– Rovann Linhalis