나는 프랑스어 모르는 ... 테이블 및 열 이름과 철자 오류가있을 수 있습니다. .. where
을 사용하여 특정 사용자 또는 도서에 대한 필터를 추가하십시오.
편집
그냥이 일을 할 수 있습니까?
: 데이터 모델에 따라 ... 기본적으로
select * from livres where idCatalogue_fk in (
select idCatalogue_fk from produitsEtCommandes where idUtilisasteur_fk=1
);
-- note the misspelling comment i made up top... the ID in productsNCommands
select * from utilisateurs where idUtilisateurs in (
select idUtilisasteur_fk from produitsEtCommandes where idCatalogue_fk in (
select idCatalogue_fk from livres where idLivre=1
)
);
(이 숙제 인 경우,이 BTW ... 데이터베이스 모델의 아주 좋은 예가 아니다)을 수행해야
- 는
- 카탈로그
- 이
- 가 commandes 가입
produitsEtCommandes을 조인 리브르 가입
그리고 모든 사람들에게 지휘관 연합을 줄 것입니다. 필요에 따라 필터링하십시오.
는 사용자 김과 관련된 모든 책을 찾는 (해당 이름을 가진 한 명의 사용자 만 가정) : 그래서
select *
from livres
join catalogue on livres.idCatalogue_fk=catalogue.idCatalogue
join produitsEtCommandes on produitsEtCommandes.idCatalogue_fk=catalogue.idCatalogue
join commandes on commandes.idCommande=produitsEtCommandes.idCommande_fk
where commandes.nomClient = 'Kim'
.... 당신은이 작업을 수행 할 수 있습니다 .....?
select * from livres where idLivre in (
select distinct idLivre
from livres
join catalogue on livres.idCatalogue_fk=catalogue.idCatalogue
join produitsEtCommandes on produitsEtCommandes.idCatalogue_fk=catalogue.idCatalogue
where idCommandes_fk=1)
또는 ... (그렇게 추한)
select *
from livres, catalogue, produitsEtCommandes, commandes
where livres.idCatalogue_fk=catalogue.idCatalogue and
produitsEtCommandes.idCatalogue_fk=catalogue.idCatalogue and
commandes.idCommande=produitsEtCommandes.idCommande_fk and
livres.title = 'Brave New World'
오, noes ...
select * from livres where idCatalogue_fk in (
select distinct idCatalogue from catalogue where idCatalogue in (
(select distinct idCatalogue_fk from produitsEtCommandes where idCommandes_fk=1)
)
)
이러한 중첩'SELECT' 문이다. 'JOIN'과 함께하는 것이 더 낫다. – ne1410s
뭐가 잘못 됐니? 샘플 데이터와 원하는 출력을 제공 할 수 있습니까? 이 세부 정보 중 일부를 포함하도록 질문을 수정하십시오. –
"무언가가 잘못되었다"는 것은 무엇을 의미합니까? – Kritner