Fitness Tracking database
Question 1- Find the names of users who have burned more than 500 calories in any
session.
Question 2- List the names and certifications of trainers who have supervised more than 10
sessions.
Question 3-Retrieve the names of all workouts that last longer than 30 minutes.
Question 4-Find the total number of sessions conducted by each trainer.
Question 5-List the users along with the total calories burned in all their sessions.
Rental Equipment Database
Question 1: Find customers who rented equipment more than 3 times in the last year:
Question 2: List all available equipment and their rental price per day:
Question 3: Retrieve rental history of a specific customer:
Question 4: Calculate the total earnings from rentals of each equipment
Question 5: Find the top-rated equipment based on customer feedback:
Library Database
Query 1: Find the names of all members who have borrowed a book with a price greater
than 1000.
Query 2: Retrieve the names and addresses of all members who have never borrowed any
books.
Query 3: Find the names of all authors who have written at least one book priced above 500.
Query 4: List the titles of books borrowed by each member along with their loan date.
Book management system
book (book_id, title, author, publisher)
member (member_id, member_name, address)
loan (loan_id, book_id, member_id, loan_date, return_date)
Q1: Find the titles of all books in the library, and remove duplicates.
Q2: Find the name, loan date, and return date of all members who have borrowed the book
titled "The Great Gatsby
Q3: Find the average loan duration (in days) for each member.
Q4: Find all members who have borrowed at least one book.
Library Management
LibraryMember (member_id, member_name, member_address)
Book (book_id, book_title, price)
Loan (loan_id, loan_date, member_id, book_id, return_date)
Author (author_id, author_name)
BookAuthor (book_id, author_id)
1. Find the names of all members who have borrowed books priced above 500.
2. Retrieve the names and addresses of all members who have never borrowed a book.
3. Find the names of all authors who have written books priced above 300.
4. List the titles of books borrowed by each member along with their loan date.
5. Find the total quantity of each book borrowed by members.
Library Database
Books (book_id, title, author, genre, price)
Members (member_id, member_name, membership_date)
Loans (loan_id, book_id, member_id, loan_date, return_date)
Authors (author_id, author_name, nationality)
BookAuthors (book_id, author_id)
1. Find the titles of books borrowed by members who joined after 2020.
2. Retrieve the names of authors who have written books in the "Science Fiction" genre.
3. List the names of members who have never borrowed any books.
4. Find the titles of books that have been borrowed more than 5 times.
5. Find the names of authors who have written more than 3 books.
Books Store Schema
books (book_id, title, author, genre, price, publisher_id)
genre will hold values like "Fiction", "Non-Fiction", "Science", etc.
publishers (publisher_id, name, location)
customers (customer_id, name, email)
orders (order_id, book_id, customer_id, order_date, order_type, amount)
order_type can hold values like "purchase" or "rent".
inventory (publisher_id, book_id, stock_quantity)
1. Find all unique genres of books available in the store.
2. Find the name, book ID, and order amount for all customers who purchased books
authored by 'J.K. Rowling'.
3. Find the total revenue generated from books by each publisher (calculated as price *
stock_quantity):
4. Find the book with the highest number of purchase orders.
5. Find the average order amount for all purchase orders.
Online Car Rental System Database
1. List all the customers who have rented a car in the last 30 days.
2. Write an SQL query to find the total earnings generated from each car model.
3. Display the details of cars that are currently unavailable for booking.
4. Find the average rental price of cars rented by each customer.
5. Generate a report of all cars that have undergone maintenance in the past 6 months
and the total maintenance cost incurred.
6. List all rental transactions that are still pending payment.
Art Installation Leasing Management Database
Question 1: Find clients who leased more than 3 art installations in the last year:
Question 2: List all available art installations and their rental prices per event:
Question 3: Retrieve leasing history for a specific client:
Question 4: Calculate total earnings for each art installation:
Question 5: Identify the most leased art installation:
Question 6: List overdue leases and their associated clients:
Question 7: Find the average rental price for each art category:
Question 8: Retrieve client feedback for a specific art installation:
Icc Database
1. List all players from a specific team (e.g., India).
2. Find the winner of a specific match using its match ID.
3. Get the details of all matches played between two teams (e.g., India and Australia).
4. Retrieve all teams and the number of players in each team.
5. List all matches and the winner of each match.
Sports Tournament Management Database
Player (player_id, player_name, age, team_id, position)
Team (team_id, team_name, coach, home_city)
Match (match_id, team1_id, team2_id, match_date, venue)
PlayerStats (player_id, match_id, goals_scored, assists, yellow_cards, red_cards)
Coach (coach_id, coach_name, team_id)
1. Find the distinct positions played by all players.
2. List the player name, team name, and goals scored for all players who scored in matches
held in 'Stadium A'.
3. Find the total goals scored by each team in all matches.
4. List the names of coaches who coach teams from the 'New York' home city.
5. Find the number of matches played by each team.
E-Commerce Database
Users - user_id, email, password, address
Products - product_id, name, price, stock
Orders - order_id, order_status, amount, ship_address
Question 1 - Find all orders placed by a specific user (based on email)
Question 2 - Find the total number of orders and total amount spent by a user
Question 3 - List all users who have placed an order with an amount greater than 100
rupees
Question 4 - List all products that have never been ordered
Question 5 - List the top 3 products with the highest stock levels
SuperMarket database
Products(product_id,product_name,price,stock)
Customers(customer_id,customer_name,phone_number)
Bills(bill_id,customer_id,bill_date,total_amount)
BillItems(item_id,bill_id,product_id,quantity)
1. Retrieve all the products with their stock available.
2.Get the total amount of a specific bill (e.g., Bill ID = 1).
3.Find all bills made by customer 'Joel Joy'
4.List all products in a specific bill (e.g., Bill ID = 1).
5.Find the total number of products supplied by each supplier, along with the supplier name.
E-commerce Management Database -
1. Find the names of all products and remove duplicates
2. Find the customer name, product name, and order date for all orders placed by "John
Doe"
3. Find the average price of products in the `product` table
4. Find all customers who have placed an order, have products in their cart, or both
5. Find the total quantity of each product sold across all order
INVENTORY MANAGEMENT
Product (product_id, product_name, category, price)
Inventory (inventory_id, product_id, stock, warehouse)
Supplier (supplier_id, supplier_name, contact)
Supply (supplier_id, product_id, supply_date, quantity_supplied)
1. Find the distinct names of all warehouses where products are stored
2. Find the product name, category, and stock of all products available in the ‘Main
Warehouse’.
3. Find the total quantity supplied for each product.
4. List the names of suppliers who have supplied at least 10 units of any product.
Company Database
1. Find the total salary paid to employees in each department, and only the list
departments with a total salary greater than 100,000.
2. List all employees along with the project names they are associated with based on
department.
3. Find the average salary of employees in each department, sorted by the highest
average salary.
4. Find the total budget allocated to departments that have more than 3 projects.
Task Management Database
Task (task_id, task_name, assigned_to, due_date, completion_status, project_id)
User (user_id, user_name, department)
Task_Assignment (assignment_id, task_id, user_id, assigned_date)
Project (project_id, project_name, project_manager_id)
1. Find the total number of completed tasks:
2.List the names of users who have been assigned more than 5 tasks:
3.Find tasks that are overdue (due_date is before the current date and completion_status is
not 'Completed'):
4.Find the number of distinct users who have completed tasks in the 'HR' department:
5.List all projects with their respective project manager names:
Employee_Database
employee (emp_id, emp_name, department, salary)
works_on (emp_id, project_no)
project (project_no, project_name, budget)
1. Find the names of all departments in the employee relations and remove duplicates.
2. Find the employee name, project number, and project name for all employees working on
a project with a budget above 1 million.
3. Find the average salary for employees in each department.
4. Find all employees working on a project, assigned to a department, or both.
DataBase-Company Employee Database
The employee database includes a table named employees with columns such as
employee_id, first_name, last_name, email, phone_number, hire_date, salary,
department_id
Q1-What is the SQL query to find the top 10 highest-paid employees in the company?
Q2-Query to update the contact information for a specific employee in the database?
Q3- What is the SQL query to find the average salary of employees in each department?
Customer Database
· Customer (cust_id, cust_name, cust_address)
· Order (order_id, order_date, cust_id, total_amount)
· Product (product_id, product_name, price)
· OrderDetails (order_id, product_id, quantity)
· Supplier (supplier_id, supplier_name, contact_number)
· ProductSupplier (product_id, supplier_id)
1. Find the names of all customers who have placed an order with a total amount
greater than 500.
2. Retrieve the names and addresses of all customers who have never placed an order.
3. Find the names of all suppliers who provide at least one product priced above 100.
4. List the names of products ordered by each customer along with their order date.
5. Find the total quantity of each product ordered by customers.
Employee Project Management
1. Find the distinct departments of all employees.
2. Find the employee name, department, and assigned hours for all employees working
on the project 'Alpha'.
3. Find the total number of hours assigned to each project.
4. List the names of clients who have contracts worth more than ₹100,000.
5. Find the names of employees who are assigned to more than 40 hours on any
project.
Student Database
students (student_id, name, age, class, grade)
courses (course_id, course_name, instructor)
enrollments (enrollment_id, student_id, course_id, enrollment_date)
grades (student_id, course_id, marks, grade)
1. Find all distinct classes in the school:
2. Find the names of all students enrolled in the "Mathematics" course along with their
enrollment dates:
3. Calculate the average marks for each course:
4. Find the student with the highest marks in the "Science" course:
5. Find the total number of enrollments per instructor:
University Management Database -
Student (student_id, student_name, age, major)
Course (course_id, course_name, credits, department)
Enrollment (enrollment_id, student_id, course_id, enrollment_date, grade)
Professor (professor_id, professor_name, department)
Teaches (professor_id, course_id, semester)
1. Find the distinct names of all departments offering courses.
2. List the student name, course name, and grade for all students enrolled in the
'Computer Science' department.
3. Find the total number of students enrolled in each course.
4. List the names of professors who are teaching in the 'Mathematics' department.
Music Streaming Software Database
1.Find the total number of songs in the 'Pop' genre:
2. List the names of users who have created more than 2 playlists:
3.Find artists who have more than 5 songs in the database:
4. Find the total number of playlists created by users with a 'Premium' subscription:
5.Find the number of distinct songs in each playlist:
Music and singers database
Question 1: List all songs by a specific singer, along with the singer's name.
Question 2: Find the average duration of songs for each singer.
Question 3: Get a list of singers from a specific country and their songs.
Question 4: Find the total number of songs for each genre.
Question 5: Retrieve the total duration of songs for each genre.
Movie Rental System Database
Question 1: List all movies that are currently available for rent:
Question 2: Find the total rental income if all movies are rented:
Question 3: Retrieve the details of movies released before the year 2000:
Question 4: Count the number of movies for each genre:
Question 5: Find the movie with the highest rental price:
Social Media Database
Question 1:- Find all users who have more than 10 friends
Question 2. Retrieve the names of users who belong to at least 3 groups
Question 3.Find the messages exchanged between two specific users
Question 4.List the groups and the number of members in each group
Question 5.Find the total number of reactions (likes, etc.) on posts made by each user:
Aircrafts Dataset
Retrieve the flight number, airline, and departure time of all flights scheduled to depart from
'JFK' airport today.
Find the total number of aircraft currently parked at each airport.
Get the list of aircraft models that have completed more than 500 flights in 2024.
Retrieve all flights that were delayed by more than 1 hour, along with their delay duration
and reason.
Get the busiest airports in terms of daily flight traffic, ranked by the number of flights
handled today
AIRPORT DATABASE
Schema:
• PoliceOfficer (officer_id, name, rank, station_id)
• Station (station_id, station_name, location)
• Case (case_id, case_type, station_id, status)
• Investigation (investigation_id, officer_id, case_id, investigation_date)
1. Find the names of all police stations in the “Case” relation and remove duplicates.
2. Find the names, case types, and statuses of all cases handled by officers from the
‘Downtown’ station.
3. Find the average number of cases handled by each police station.
4. Find all police officers who are assigned to a case, a station, or both.
ROLL NO 37 : AIRPORT DATABASE
Flights (flight_id, flight_number, departure_airport, arrival_airport, departure_time,
arrival_time)
Airports (airport_id, airport_name, city, country)
Passengers (passenger_id, name, email)
Bookings (booking_id, passenger_id, flight_id, seat_number, status)
1.Find all passengers who have made a booking for a flight to 'LAX' airport.
2.Find the flight number, departure airport, and arrival airport for all flights departing from
'JFK' airport.
3.Find the average number of bookings per flight.
4.List all flights (flight number) that have no bookings.
5.Find all passengers who have booked more than 2 flights.
RAILWAY MANAGEMENT DATABASE
Question 1:Find the names of all trains operating on a specific route and remove duplicates.
Question 2: Find the train name, departure time, and arrival time for all trains departing from
Central Station.
Question 3: Find the total number of bookings for each train.
Question 4: Find all passengers who have booked tickets for a specific train, along with their
contact information.
QUESTION 5: Find the contact information of all passengers who booked a seat number
greater than 50 for any train
Stock Price Dataset
1. Retrieve the stock symbol, stock name, and industry for all stocks traded on the
NASDAQ stock exchange.
2. Find the maximum close_price of a stock and its corresponding stock_symbol for the
date '2024-10-01'.
3. Get the total dividend amount issued by a specific stock symbol, say 'AAPL', across
all dividend dates.
4. Find all stock splits that occurred in the year 2023.
5. What query can return the top 5 stocks with the highest percentage growth over the
past week?
Stock market schema
stocks (stock_id, company_name, exchange, sector, current_price)
exchange will hold values like "NSE" or "BSE".
investor (investor_id, name, email)
transactions (transaction_id, stock_id, investor_id, transaction_type, amount,
transaction_date)
portfolio (investor_id, stock_id, quantity)
Questions -
1- What is the current price of Reliance Industries on NSE?
2-Which sectors have the highest total stock value?
3-Who is the investor with the most transactions?
4- What stocks does Ramesh Sharma own?
5-How much has Ramesh Sharma invested in total?