User details based on Cancellation in SQL

Question:

User details based on Cancellation

Write query to display user_id and user name of those who have canceled their tickets and display records in ascending order by user_id. (Hint: Take user, tickets and cancellation tables)

User details based on Cancellation

Code:

Main.sql

select u.USER_ID, u.NAME
from ((users u inner join tickets t
                      on u.USER_ID=t.USER_ID) inner join cancellation c
                               on t.ticket_id=c.ticket_id)
where cancellation_ID is not null
group by u.USER_ID, u.NAME
order by 1;

Recommended:

1 thought on “User details based on Cancellation in SQL”

Leave a Comment

Your email address will not be published. Required fields are marked *

x