Question
Write SQL queries for the following scenarios and retrieve required information from the MySql database tables Passenger & Price 1. How many Female and how
Write SQL queries for the following scenarios and retrieve required information from the "MySql" database tables "Passenger" & "Price" 1. How many Female and how many male passengers travelled for a minimum distance of 600 KM s? 2. Find the minimum ticket price for AC compartment 3. Select passenger names whose names start with character 'S' 4. Calculate price charged for each passenger displaying Passenger name, Boarding station, Destination station, Compartment, Price in the output Question 3 - SQL - Passenger & Price 5. What is the passenger name and his/her ticket price who travelled in Non-AC compartment for a distance of 1000 KM s 6. Linda Travelled from Mumbai to Goa, if she had travelled from Mumbai to Chennai calculate how much extra cost does she need to pay (distance should not be hardcoded in the query) 7. What will be the AC and Non-AC charge for Tina to travel from Bangalore to Goa? 8. List the distances from "Passenger" table which are unique (non-repeated distances) 9. Display the passenger name and percentage of distance travelled by that passenger from the total distance travelled by all passengers without using user variables 10. How many times did character 'a' appear in the column passenger name of "Passenger" table DatabaseConnection details Database Tables: Here are 2 Tables 'Passenger' and 'Price' which have the travel details of passengers and the relative price. 1. 'Passenger' database table reference MySQL Database connection details Server Address/Host Name dbi-bc2020.cok3fwhxp8bt.us-west-2.rds.amazonaws.com Port 3306 DB Name (Database Name) travel User id bcuser Password GajiNi1i Passenger_ Name Category Gende r Boarding_ Station Destination _Station Distanc e Compartme nt Sam General M Chennai Bangalore 350 AC Charlie Tatkal M Hyderabad Mumbai 700 Non-AC Tina General F Bangalore Goa 600 AC Carl General M Mumbai Chennai 1500 AC Sarah Tatkal F Goa Trivandrum 1000 AC John General M Hyderabad Nagpur 500 Non-AC Linda Tatkal F Mumbai Goa 700 AC Mike Tatkal M Bangalore Hyderabad 500 Non-AC Chris General M Nagpur Pune 700 Non-AC 2. 'Price' database table reference Compartment Distance Price AC 350 770 AC 500 1100 AC 600 1320 AC 700 1540 AC 1000 2200 AC 1200 2640 AC 1500 3300 Non-AC 350 434 Non-AC 500 620 Non-AC 600 744 Non-AC 700 868 Non-AC 1000 1240 Non-AC 1200 1488 Non-AC 1500 1860
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started