DROP VIEW vista_cd; CREATE VIEW vista_cd as SELECT cd_id,file_name, a.artist_name, b.album_name, ab.as_track, s.song_name FROM FILE f JOIN artist a ON f.artist_id= a.artist_id JOIN ALBUM b ON f.artist_id = b.artist_id AND f.album_id = b.album_id JOIN album_song ab ON f.artist_id=ab.artist_id AND f.album_id=ab.album_id and f.song_id=ab.song_id JOIN song s ON f.song_id::text = s.song_id::text;