标签: sql oracle pivot
SELECT NAME, TITLE_ID FROM NAME INNER JOIN KNOWN_FOR_TITLES USING (NAME_ID) INNER JOIN NAMES_PROFESSIONS USING (NAME_ID) INNER JOIN PROFESSIONS USING (PROFESSION_ID) WHERE PROFESSIONS = 'actor' OR PROFESSIONS = 'actress' ORDER BY NAME_ID;