I am a student taking an online course in data analytics. I'm learning SQL and it is my first time doing any type of coding. Recently, I've been encountering a problem where after following the instructions to the 't' I get error messages that look like this: Syntax error: Expected end of input but got "(" at [3:8]
What I've done is to let my computer sleep on it and then the following day I delete all my work and start over again. Sometimes this works. I've even reached out to the course's AI coach which could only take me so far.
Here is the SQL query:
SELECT
usertype,
CONCAT (start_station_name," to ", end_station_name) AS route,
COUNT (*) as num_trips,
ROUND(AVG(cast(tripduration as int64)/60),2) AS duration
FROM
`bigquery-public-data.new_york.citibike_trips`
GROUP BY
start_station_name, end_station_name, usertype
ORDER BY
num_trips DESC
LIMIT 10
I am a student taking an online course in data analytics. I'm learning SQL and it is my first time doing any type of coding. Recently, I've been encountering a problem where after following the instructions to the 't' I get error messages that look like this: Syntax error: Expected end of input but got "(" at [3:8]
What I've done is to let my computer sleep on it and then the following day I delete all my work and start over again. Sometimes this works. I've even reached out to the course's AI coach which could only take me so far.
Here is the SQL query:
SELECT
usertype,
CONCAT (start_station_name," to ", end_station_name) AS route,
COUNT (*) as num_trips,
ROUND(AVG(cast(tripduration as int64)/60),2) AS duration
FROM
`bigquery-public-data.new_york.citibike_trips`
GROUP BY
start_station_name, end_station_name, usertype
ORDER BY
num_trips DESC
LIMIT 10
Share
Improve this question
edited Nov 16, 2024 at 15:17
Thorsten Kettner
95.7k8 gold badges56 silver badges79 bronze badges
asked Nov 16, 2024 at 14:45
Motlalepula MmesiMotlalepula Mmesi
1
1
|
1 Answer
Reset to default -1SELECT
usertype,
CONCAT(start_station_name, " to ", end_station_name) AS route,
COUNT(*) AS num_trips,
ROUND(AVG(CAST(tripduration AS INT64) / 60), 2) AS duration
FROM
`bigquery-public-data.new_york.citibike_trips`
GROUP BY
start_station_name, end_station_name, usertype
ORDER BY
num_trips DESC
LIMIT 10;
bigquery-public-data
makes delimiters probably necessary, because of the minus sign that is not to be interpreted to mean minus. But wouldn't you then use them around the name itself:FROM `bigquery-public-data`.new_york.citibike_trips
? – Thorsten Kettner Commented Nov 16, 2024 at 15:08