Sql in dBeaver Date Format

I m using dBeaver to practise to SQL queries. While the date format is set to MM-dd-yy and I use the same format in syntax the output value is not a date datatype. Maybe it is a float.

When coding the following query the output value of action_date is '02' and '02' (probably float)instead of '02-13-22' and '02-14-22'. How can i fix it so i can subtract the dates :

WITH users (user_id, action, action_date) 
AS (VALUES 
      (1, 'start', CAST('02-13-22' AS date)), 
      (1, 'cancel', CAST('02-14-22' AS date))
SELECT * FROM  users
2
Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article