2808 explained code solutions for 75 technologies


clickhouseHow to insert UUID into table


INSERT INTO utbl SELECT generateUUIDv4(), today(), 'Joe'ctrl + c
utbl

name of the table with UUID column

generateUUIDv4

generates UUID value

today()

sample value for date column

'Joe'

sample value for col column


Usage example

INSERT INTO utbl SELECT generateUUIDv4(), today(), 'Joe';
SELECT * FROM utbl;
output
┌─id───────────────────────────────────┬───────date─┬─col─┐
│ 4b06cbf8-96cc-4d85-8cfc-5cb905bf45d0 │ 2022-01-12 │ Joe │
└──────────────────────────────────────┴────────────┴─────┘