From 847c9589b05084f08293b4e2caff5a5f0be7d94b Mon Sep 17 00:00:00 2001 From: chloecheng8 <30807247+chloecheng8@users.noreply.github.com> Date: Tue, 21 Nov 2023 14:54:22 -0800 Subject: [PATCH] added catalog CRUD queries --- server/queries/catalog.sql | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 server/queries/catalog.sql diff --git a/server/queries/catalog.sql b/server/queries/catalog.sql new file mode 100644 index 0000000..d1a67d0 --- /dev/null +++ b/server/queries/catalog.sql @@ -0,0 +1,22 @@ +-- GET - Returns all data from the catalog table +SELECT * FROM catalog; + + +-- GET/:id - Returns the row that matches the id +SELECT * FROM catalog WHERE id = ?; + + +-- POST - Adds a new row to the catalog table +INSERT INTO catalog (id, host, title, event_type, subject, description, year) +VALUES (?, ?, ?, ?, ?, ?, ?); + + +-- PUT - Updates an existing row given an id +-- All fields are optional +UPDATE catalog +SET host = ?, title = ?, event_type = ?, subject = ?, description = ?, year = ? +WHERE id = ?; + + +-- DELETE - deletes an existing row given an id +DELETE FROM catalog WHERE id=?; \ No newline at end of file