The database should contain the following six tables:
The
Artists (artist_id: char(30), artist_name: char(30), artist_pop: int(5))
Tracks (track_id: char(30), track_name: char(30), duration: int(10), tempo:real) Record (artist_id: char(30), track_id: char(30))
Users (user_id: char(30), user_name: char(30), age: int(5), nationality: char(30), num_track_listened: int(10))
Listen (user_id: char(30), track_id: char(30))
Follow (user_id: char(30), artist_id: char(30), follow_date: datetime)
Write a single SQL query for each request below.
-
Find the ids of those users who have listened to at least one track but have not followed any artists.
-
Find the ids and names of those users who have listened to some tracks recorded by the artist named 'Adele'.
- Find the ids and names of those users who have not listened to any track recorded by the artist named 'Adele'. Use ''NOT EXISTS'' to answer this query.
Step by step
Solved in 2 steps