Below is a database labeled Airlines, with tables named Aircraft, Airports, Carr
ID: 3847760 • Letter: B
Question
Below is a database labeled Airlines, with tables named Aircraft, Airports, Carriers and Flights. This database is already created. I need help to create a query that will:
1.) Concatenate the manufafturer and model_number from aicrafts that were built from 01/01/2010 - 12/31/2015 into one column named Plane_Type
2.) In the second column, list the number of seats from those aircrafts with 2 decimal places after the decimal (100.00), and list the aircraft with highest seat count first. It should look something like this.
Airlines Database
Primary Key = Plane_ID
Foreign Key = Carrier_ID references Carriers (Carrier_ID)
Aircraft
Plane_ID
Manufacurer
Model_Num
Original_Purchase_Date
Last_Service
Carrier_ID
Number_of_Seats
Airports
Airport_Code
Airport_Location
Year_Opened
Nuber_of_Terminals
Primary Key = Airport_code
Carriers
Carrier_ID
Carrier_Name
Primary Key = Carrier_ID
Flights
Flight_ID
Plane_ID
Carrier_ID
Airport_Code_Origin
Airport_Code_Destination
Departure_DateTime
Arrival_DateTime
Primary Key = Flight_ID
Foreign Key = Airport_Code_Origin references Airports(Airpot_Code)
Airport_Code_Destination references Airports(Airport_Code)
Aircraft
Plane_ID
Manufacurer
Model_Num
Original_Purchase_Date
Last_Service
Carrier_ID
Number_of_Seats
Plane Type Boring-Rocketship-123 Air Scooter-Putt Putt XJ 314 right Bros-Canvas Delite 987 Number o seats 50.00 3000 2.00Explanation / Answer
Query for the both questions is:
Select concat(Manufacurer,'-',Model_Num) as Plan_Type, Number_of_seats decimal(10,2) from Aircraft
where manufacurer_date>'01/01/2010' and manufacurer_date<'12/31/2015'
Explaination:
we use concat() method to concatenate two or more columns and we use as for column alias.
And we use decimal(P,D)
P is the precision that represents the number of significant digits.
D is the scale that that represents the number of digits after the decimal point.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.