我有桌å
Manga
idmanga idgenre idauthor title
Author
idauthor name surname
Genre
idgenre genre
我想创建包å«å—æ®µæ ‡é¢˜ï¼Œæµæ´¾ï¼Œå§“å,姓æ°
çš„è¡¨æ ¼select * from Manga
inner join Author on Manga.idauthor=Author.idauthor
inner join Genre on Manga.idgenre=Genre.idgenre
é€šè¿‡è¿™æ ·çš„æŸ¥è¯¢ï¼Œæˆ‘å¾—åˆ°äº†æ‰€æœ‰è¡¨ä¸çš„所有列。如何排除ä¸éœ€è¦çš„列?
ç”案 0 :(得分:5)
而ä¸æ˜¯ç¼–写SELECT *
,åªéœ€åˆ—出您想è¦çš„列。它还有助于为表æ供别å:
select m.title, g.genre, a.name, a.surname
from Manga m
inner join Author a on m.idauthor=a.idauthor
inner join Genre g on m.idgenre=g.idgenre
ç”案 1 :(得分:2)
使用表别å指定您需è¦ç‰¹å®šåˆ—的表:
SELECT m.title, g.genre, a.name, a.surname
FROM Manga m
INNER JOIN Author a on m.idauthor = a.idauthor
INNER JOIN Genre g on m.idgenre = g.idgenre
ç”案 2 :(得分:1)
您ä¸èƒ½æŽ’除ä¸éœ€è¦çš„列,åªåŒ…å«æ‰€éœ€çš„列:
select Manga.title, Genre.genre, Author.name, Author.surname from Manga
inner join Author on Manga.idauthor=Author.idauthor
inner join Genre on Manga.idgenre=Genre.idgenre