<commit_before>-- PREPARE DATABASE

CREATE TABLE observations
(
    uid serial NOT NULL,
    observationtime timestamp,
    windspeed real,
    winddirection varchar (3),
    significantwaveheight real,
    dominantwaveperiod integer,
    averageperiod real,
    meanwavedirection varchar (3),
    airtemperature real,
    watertemperature real
);

ALTER TABLE observations
   ADD COLUMN rowcreated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT clock_timestamp();

-- Extract CSV
\copy (SELECT observationtime, significantwaveheight, dominantwaveperiod, averageperiod, airtemperature, watertemperature FROM observations) TO data.csv CSV DELIMITER ',';

-- Select Max wave height ever
SELECT * FROM observations ORDER BY significantwaveheight DESC LIMIT 1;

-- Select Max wave height in given year
SELECT * FROM observations WHERE EXTRACT(year FROM "rowcreated") = 2016 ORDER BY significantwaveheight DESC LIMIT 1;<commit_msg>Select 10 most recent observations<commit_after>-- PREPARE DATABASE

CREATE TABLE observations
(
    uid serial NOT NULL,
    observationtime timestamp,
    windspeed real,
    winddirection varchar (3),
    significantwaveheight real,
    dominantwaveperiod integer,
    averageperiod real,
    meanwavedirection varchar (3),
    airtemperature real,
    watertemperature real
);

ALTER TABLE observations
   ADD COLUMN rowcreated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT clock_timestamp();

-- Extract CSV
\copy (SELECT observationtime, significantwaveheight, dominantwaveperiod, averageperiod, airtemperature, watertemperature FROM observations) TO data.csv CSV DELIMITER ',';

-- Select Max wave height ever
SELECT * FROM observations ORDER BY significantwaveheight DESC LIMIT 1;

-- Select Max wave height in given year
SELECT * FROM observations WHERE EXTRACT(year FROM "rowcreated") = 2016 ORDER BY significantwaveheight DESC LIMIT 1;

-- Select last 10 observations
SELECT * FROM observations ORDER BY rowcreated DESC LIMIT 10;
{'fraction_non_alphanumeric': 0.05518650996423097, 'fraction_numerical': 0.011241696474195196, 'mean_word_length': 4.6753623188405795, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6670839', 'n_tokens_mistral': 517, 'n_tokens_neox': 481, 'n_words': 206}