This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE IF NOT EXISTS items ( | |
id serial PRIMARY KEY | |
); | |
CREATE TABLE IF NOT EXISTS industries ( | |
id serial PRIMARY KEY, | |
name text UNIQUE NOT NULL | |
); | |
CREATE TABLE IF NOT EXISTS items_industries ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT task_events.task_id, task_events.state | |
FROM tasks | |
INNER JOIN task_events ON task_events.task_id = tasks.id | |
WHERE task_events.created_at = | |
(SELECT MAX(task_events.created_at) FROM task_events WHERE task_events.task_id = tasks.id) | |
GROUP BY tasks.id, task_events.id | |
ORDER by tasks.id ; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- DDL | |
-- company | |
CREATE TABLE company ( | |
id SERIAL PRIMARY KEY NOT NULL, | |
name VARCHAR(64) NOT NULL, | |
date_certif_start DATE NOT NULL, | |
date_certif_end DATE NOT NULL, | |
status SMALLINT NOT NULL, | |
about VARCHAR NULL | |
); |