

-- Création de la base de données CandyCrush
DROP DATABASE IF EXISTS CandyCrush;
CREATE DATABASE CandyCrush DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE CandyCrush;
	
	
-- Création de la table Game
CREATE TABLE Game (
    idGame INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    Score INT NULL  ,
    idUser INT NOT NULL,
    DateGame DATETIME NOT NULL,
    Duree INT NOT NULL,
	DateEndGame DATETIME NOT NULL ,
    Niveau INT NOT NULL DEFAULT 1 , 
    FOREIGN KEY (idUser) REFERENCES Users (idUser)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;


-- Insertion de données dans la table Game

INSERT INTO Game (idGame, Score,  idUser, DateGame, Duree, DateEndGame, Niveau) VALUES
    (1, 1000, 1, '2023-10-20 20:10:00', 4, '2023-10-20 20:14:00', 10),
    (2, 500, 2, '2024-10-20 20:11:00', 5, '2024-10-20 20:15:00', 5);



