From 779e4a78918444b50e00dfc58c103ec28092f15a Mon Sep 17 00:00:00 2001 From: brongniart Date: Wed, 20 Nov 2024 17:22:59 +0100 Subject: [PATCH] -- --- insert_all_data.sql | 64 +++++++++++++++++++++++++++++++++++++++++++-- scripts/init.sql | 3 +-- 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/insert_all_data.sql b/insert_all_data.sql index ba2876e..922aca4 100644 --- a/insert_all_data.sql +++ b/insert_all_data.sql @@ -494,6 +494,19 @@ INSERT INTO Quote (id_quote, content, likes, langue, isValide, reason, id_caract INSERT INTO Quote (id_quote, content, likes, langue, isValide, reason, id_caracter, id_source, id_user_verif) VALUES ('184', 'Mon nom est Po, et il va me falloir un chapeau !', 0, 'fr', true, 'insertion de test', 52, 37, 1); INSERT INTO Quote (id_quote, content, likes, langue, isValide, reason, id_caracter, id_source, id_user_verif) VALUES ('185', 'Tu viens de me montrer au complet ?!', 0, 'fr', true, 'insertion de test', 38, 10, 1); +-- INSERTION TABLE QUESTION +INSERT INTO Question (texte, answerA, answerB, answerC, answerD, cAnswer) +VALUES +('May the Force be with you.', 'Star Wars', 'Star Trek', 'The Matrix', 'Blade Runner', 'Star Wars'), +('I m gonna make him an offer he can t refuse.', 'The Godfather', 'Goodfellas', 'Scarface', 'The Sopranos', 'The Godfather'), +('To infinity and beyond!', 'Toy Story', 'The Incredibles', 'Finding Nemo', 'Shrek', 'Toy Story'), +('All we have to decide is what to do with the time that is given to us.', 'The Lord of the Rings', 'Harry Potter', 'The Hobbit', 'Narnia', 'The Lord of the Rings'), +('I am your father.', 'Star Wars', 'The Terminator', 'Star Trek', 'Guardians of the Galaxy', 'Star Wars'), +('It is a trap!', 'Star Wars', 'Battlestar Galactica', 'Star Trek', 'The Matrix', 'Star Wars'), +('Winter is coming.', 'Game of Thrones', 'The Witcher', 'Vikings', 'The Mandalorian', 'Game of Thrones'), +('Elementary, my dear Watson.', 'Sherlock Holmes', 'Agatha Christie', 'Poirot', 'The Hound of the Baskervilles', 'Sherlock Holmes'), +('Here is looking at you, kid.', 'Casablanca', 'Gone with the Wind', 'Citizen Kane', 'The Maltese Falcon', 'Casablanca'); + INSERT INTO Commentary (id_comment, quote, users, dateC, comment) VALUES ('1', '1', '1', '2024-10-01', 'This quote really resonates with me.'), @@ -505,7 +518,54 @@ VALUES ('7', '7', '1', '2024-10-07', 'I find this quote very inspiring.'), ('8', '8', '1', '2024-10-08', 'I think there’s more to this than meets the eye.'), ('9', '9', '3', '2024-10-09', 'Such a powerful statement!'), -('10', '1','2', '2024-10-10', 'This is one of my favorites!') +('10', '1','2', '2024-10-10', 'This is one of my favorites!'); + +-- INSERTION TABLE Quiz +INSERT INTO Quiz (nb_quest) +VALUES +(10), +(10), +(10), +(10), +(10), +(10), +(10), +(10), +(10), +(10); + +-- INSERTION TABLE Quiz_Question +INSERT INTO Quiz_Question (quiz, question) +VALUES +(1, 1), -- Quiz 1, Question 1 +(1, 2), -- Quiz 1, Question 2 +(1, 3), -- Quiz 1, Question 3 +(2, 1), -- Quiz 2, Question 1 +(2, 4), -- Quiz 2, Question 4 +(3, 2), -- Quiz 3, Question 2 +(3, 5), -- Quiz 3, Question 5 +(4, 6), -- Quiz 4, Question 6 +(5, 3), -- Quiz 5, Question 3 +(5, 7); -- Quiz 5, Question 7 + + +-- INSERTION TABLE Record_quiz +INSERT INTO Record_quiz (users, quiz, nbPoint, timeQ) +VALUES +(1, 1, 10, 25), +(1, 2, 15, 40), +(1, 3, 20, 30), +(2, 1, 5, 20), +(2, 5, 18, 60), +(2, 2, 12, 35), +(3, 4, 25, 50), +(3, 3, 0, 10), +(3, 1, 14, 45); + +UPDATE Quote +SET isCitationDuJour = false +where id_quote!=185; UPDATE Quote -SET isCitationDuJour = false; +SET isCitationDuJour = true +where id_quote=185; diff --git a/scripts/init.sql b/scripts/init.sql index 88cbc46..c572d35 100644 --- a/scripts/init.sql +++ b/scripts/init.sql @@ -48,8 +48,7 @@ CREATE TABLE Question( CREATE TABLE Quiz( id_quiz SERIAL PRIMARY KEY, - levelQ numeric NOT NULL, - timer numeric NOT NULL + nb_quest numeric ); CREATE TABLE Quiz_Question(