I have a members table with four columns.
table members.tbl_member as U {
member_id int [pk, increment]
date_created timestamp [not null, default: `CURRENT_DATE`]
date_modified timestamp [not null, default: `CURRENT_DATE`]
date_security timestamp [not null, default: `CURRENT_DATE`]
}
(create script from DbDiagram)
Every column is either a auto increment primary key, or has a default value.
I want to be able to trigger an insertion on this row, and return the inserted row, but to do this I don’t need or want to insert any values for any timestamp as the that is handled by the defaults.
INSERT INTO members.tbl_member
VALUES (nothing!)
RETURNING
member_id AS MemberID,
date_created AS DateCreated,
date_modified AS DateModified,
date_security AS DateSecurity
How can I do this?
2
Answers
You can use DEFAULT for this:
use
default values