Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Boolean
Date and time
38. Datetime
Summary

Instruction

Finally, we're going to learn a mixture of the types date and time - datetime, which is also called timestamp. The format for timestamp is yyyy-MM-dd hh:mm:ss. As you can see, it includes both the date and the time. It has various names in various databases: timestamp, datetime, smalldatetime. In our database, all of these names work.

Exercise

Peter wants to create yet another version of his table payment, with the following columns: user_id (integer), amount (decimal(4,2)) and date_time (timestamp). Create the new table.

Stuck? Here's a hint!

Type

CREATE TABLE payment (
    user_id int,
    amount decimal(4,2),
    date_time timestamp
);