Created
July 1, 2019 15:41
-
-
Save chriscarlsondev/8e45a2971811bdc60945f0b1d5832e87 to your computer and use it in GitHub Desktop.
SQL statements to create a shopping list table and enum
This file contains 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
DROP TYPE IF EXISTS grocery; | |
CREATE TYPE grocery AS ENUM ( | |
'Main', | |
'Snack', | |
'Lunch', | |
'Breakfast' | |
); | |
CREATE TABLE IF NOT EXISTS shopping_list ( | |
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, | |
name TEXT NOT NULL, | |
price decimal(12,2) NOT NULL, | |
date_added TIMESTAMP DEFAULT now() NOT NULL, | |
checked BOOLEAN DEFAULT false NOT NULL, | |
category grocery NOT NULL | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment