...

/

Insert Data into the orders Table

Insert Data into the orders Table

Learn to insert data into the orders table.

Before we do anything else, let’s see our customers table:

Press + to interact
select * from customers;

Use of current_timestamp with insert

Now, we’re going to insert a new order in the orders table. We’ll use the following command:

insert into orders (order_number, ordered_at, customer_id) values ('ABC001', current_timestamp, 1);

Before we actually execute this command, let’s look at the new stuff here. Specifically, lets take a look at current_timestamp. This is used as a value for the ordered_at ...