Customer details based on booking count in SQL

Question:

Customer details based on booking count

Write a query to display user id and user name where number of seats booked by the user in individual booking is greater than 1. Display records in ascending order by user name.

Customer details based on booking count

Code:

Main.sql

select distinct u.user_id, u.name
from users u join tickets t on u.user_id=t.user_id
where t.no_seats>1
order by 2;

Recommended:

Leave a Comment

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