Skip to content

Instantly share code, notes, and snippets.

@vipassanaecon
Last active December 30, 2021 22:39
Show Gist options
  • Save vipassanaecon/d96d991919ee8cbb1ef1f7e3cc068bd1 to your computer and use it in GitHub Desktop.
Save vipassanaecon/d96d991919ee8cbb1ef1f7e3cc068bd1 to your computer and use it in GitHub Desktop.
SQL for medium article 2
CREATE TABLE IF NOT EXISTS red_wine
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
fixed_acidity REAL NOT NULL,
volatile_acidity REAL NOT NULL,
citric_acid REAL NOT NULL,
residual_sugar REAL NOT NULL,
chlorides REAL NOT NULL,
free_sulfur_dioxide INTEGER NOT NULL,
total_sulfur_dioxide INTEGER NOT NULL,
density REAL NOT NULL,
pH REAL NOT NULL,
sulphates REAL NOT NULL,
alcohol REAL NOT NULL,
quality INTEGER NOT NULL,
type TEXT NOT NULL
);
INSERT INTO red_wine
(
fixed_acidity,
volatile_acidity,
citric_acid,
residual_sugar,
chlorides,
free_sulfur_dioxide,
total_sulfur_dioxide,
density,
pH,
sulphates,
alcohol,
quality,
type
)
VALUES
(7.4, 0.7, 0, 1.9, 0.076, 11, 34, 0.9978, 3.51, 0.56, 9.4, 5, 'RED'),
(7.8, 0.88, 0, 2.6, 0.098, 25, 67, 0.9968, 3.2, 0.68, 9.8, 5, 'RED'),
(7.8, 0.76, 0.04, 2.3, 0.092, 15, 54, 0.997, 3.26, 0.65, 9.8, 5, 'RED'),
(11.2, 0.28, 0.56, 1.9, 0.075, 17, 60, 0.998, 3.16, 0.58, 9.8, 6, 'RED'),
(7.4, 0.7, 0, 1.9, 0.076, 11, 34, 0.9978, 3.51, 0.56, 9.4, 5, 'RED'),
(7.4, 0.66, 0, 1.8, 0.075, 13, 40, 0.9978, 3.51, 0.56, 9.4, 5, 'RED'),
(7.9, 0.6, 0.06, 1.6, 0.069, 15, 59, 0.9964, 3.3, 0.46, 9.4, 5, 'RED'),
(7.3, 0.65, 0, 1.2, 0.065, 15, 21, 0.9946, 3.39, 0.47, 10, 7, 'RED'),
(7.8, 0.58, 0.02, 2, 0.073, 9, 18, 0.9968, 3.36, 0.57, 9.5, 7, 'RED'),
(7.5, 0.5, 0.36, 6.1, 0.071, 17, 102, 0.9978, 3.35, 0.8, 10.5, 5, 'RED');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment