Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

I am new to SQL. I need in big query to add a column Duration with a calculation that is the diff of ended_at and started_at, and added

$
0
0

I am new to SQL. I need in big query to add a NEW column "Duration" with a calculation that is the diff of ended_at and started_at, and added to the existing table, I don't want to create a new table.I am using:

SELECT TIMESTAMP_DIFF(ended_at, started_at, MINUTE) AS DurationFROM total_bike

but this creates a new table.

I was able to create a new table with this, but I dont know how to include the calculation:ALTER TABLE total_bike ADD COLUMN Duration Int

How can I do both in one query?


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>