Timestamps and TTLs

Author: Al-mamun Sarkar Date: 2020-09-22 07:14:33

In this lesson, I will show you how to get insert or update of a column and how to add TTL on update and insert query.


Getting writetime of a column:

SELECT city, name, writetime(name) 
FROM employees;


Adding TTL (Time To Live) on Update query:

UPDATE employees USING TTL 30 SET name='Bob' WHERE id = 1;

Column will be deleted after given seconds here 30 seconds.


Using TTL on Insert Query:

INSERT INTO employees (id, city, name) 
VALUES ( 4, 'Rangpur', 'Jon Doe')