Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE todo(
- id SERIAL PRIMARY KEY,
- title VARCHAR(255) NOT NULL,
- details VARCHAR(8000) NULL,
- priority INTEGER NOT NULL DEFAULT '1',
- created_at TIMESTAMP NOT NULL,
- completed_at TIMESTAMP NULL,
- );
- INSERT INTO todo (title, priority, created_at, completed_at) VALUES ('Clean the garage', 2, current_timestamp, current_timestamp);
- INSERT INTO todo (title, priority, created_at) VALUES ('Poop scoop', 3, current_timestamp);
- INSERT INTO todo (title, priority, created_at) VALUES ('Feed pets', 1, current_timestamp);
- INSERT INTO todo (title, priority, created_at) VALUES ('Smell the roses', 2, current_timestamp);
- INSERT INTO todo (title, priority, created_at) VALUES ('Fight the zombies', 1, current_timestamp);
- SELECT * FROM todo WHERE completed_at IS NULL;
- SELECT * FROM todo WHERE priority > 1;
- UPDATE todo SET completed_at = current_timestamp WHERE id = 148;
- DELETE FROM todo WHERE completed_at IS NOT NULL;
- SELECT * FROM todo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement