I need help on the best data type and format needed to insert times into a table.
For example, I have a table FLIGHT in which I want to insert flight arrivals and flight departures so that it looks exactly like this
flightArrival flightDepature 7:00AM 2:00PM
What format do I need to get this?
I used data type "time" and it doesn't work on my SQL. So I tried the TIMESTAMP data type and used this format TO_TIMESTAMP('07:00:00', 'hh24:mi:ss')
and it gave me something else that I have posted Screenshot below.
What data types and formats can I use to insert into my table to get accurate output?
Using TIME data type, it didn't work at all, then I tried TIMESTAMP TO_TIMESTAMP('07:00:00', 'hh24:mi:ss') to try to enter the time, but it gave me different output. It gives me 01-JUL-23 07.00.00.000000000 AM instead of 07:00AM
P粉8091101292023-09-10 00:24:40
You should call date_format
to format the datetime data as needed.
Tip: Look for the %r
flag.