How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask ATLPROG Your Own Question
ATLPROG, Computer Software Engineer
Category: Programming
Satisfied Customers: 7677
Experience:  MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
Type Your Programming Question Here...
ATLPROG is online now
A new question is answered every 9 seconds

Wondering if anyone can help me figure out a query that is

Customer Question

Wondering if anyone can help me figure out a query that is stumping me
Submitted: 1 year ago.
Category: Programming
Customer: replied 1 year ago.
Task: create a query to count the number of flights using the select statement and a left join.Original:
SELECT, flight.origincityid, COUNT(origincityid) AS numflights FROM city LEFT JOIN flight ON GROUP BY origincityidTable details:
city = id, name
flight = number, origincityid, destinationcityid, departure, duration, stops
Expert:  tejas_speed replied 1 year ago.

Hello, I would like to assist you on this.

Expert:  tejas_speed replied 1 year ago.

Could you May i know on what basis do you want number of flights?

Customer: replied 1 year ago.
Number of flights leaving different cities, grouped by city. There will be two null cities listed in my tables, with no flights
Customer: replied 1 year ago.
AS it stands, my current query doesn't show all the cities
Customer: replied 1 year ago.
Here is the data from the database, each sheet represents a table. I could not upload a SQL file here so used Excel format instead.
Customer: replied 1 year ago.
How's it going?
Customer: replied 1 year ago.
Shall I request a refund? Or will I be receiving a helpful response?
Expert:  tejas_speed replied 1 year ago.

let me reply you shortly sir.sorry for it.

Customer: replied 1 year ago.
It would be appreciated. I could have got a response sooner, elsewhere.
Expert:  tejas_speed replied 1 year ago.

select as cityname, count(flight.number) as NoOfFlights , flight.number as flightnumber from city left join flight on flight.origincityid = group by flight.origincityid, flight.number,

Customer: replied 1 year ago.
Sydney should come up as 2 (not seperate), as it has two flights leaving there.
Customer: replied 1 year ago.
flight.number not needed in final table, just counted
Customer: replied 1 year ago.
Actually, I figured that part out easily...thanks.
Expert:  tejas_speed replied 1 year ago.

great to hear that. Please accept the answer if it helps. Please let me know if you have any issue. I will make sure to complete it ASAP. I had connectivity problems since last two days so really sorry to reply you so late. Have a good day ahead.