-- Création de la base de données DiamondBallZ

DROP DATABASE IF EXISTS DiamondBallZ;
CREATE DATABASE DiamondBallZ DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE DiamondBallZ;
	
	
-- Création de la table Game avec la colonne "Rang"

CREATE TABLE Game (
    idGame INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    Score INT NULL,
    idUser INT NOT NULL,
    DateGame DATETIME NOT NULL,
    Duree TIME,
    Niveau INT NOT NULL DEFAULT 1,
    Rang INT NOT NULL DEFAULT 0, 
    FOREIGN KEY (idUser) REFERENCES Users (idUser)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

INSERT INTO Game (idGame, Score, idUser, DateGame, Duree, Niveau, Rang) VALUES
    (1, 500, 1, '2024-03-01 09:09:38', '00:00:09', 5, 2),
	(2, 1000, 2, '2024-03-01 09:09:38', '00:00:09', 10, 1);



