I am trying following query to insert data from a file. How do I calculate TOTAL_HOURS from in_date and out_date? I know we can not select them as "as in_date" and use it later. It was for illustration purpose only. The script is reading data from a file and it is not stored in database yet.
insert into Table_A (
Id,
IN_DATE,
OUT_DATE,
TOTAL_HOURS,
)
values (
1,
'2021-10-04 07:00:00' as in_date,
'2021-10-04 07:00:00' as out_date,
DATEDIFF(second, out_date, in_date) / 3600.0
);