Réalisation de la base de donnée - abretaire/Gestion-des-stocks-pharmacie GitHub Wiki

Welcome to the Gestion-des-stocks-pharmacie wiki!

Voici ci-dessous les requêtes effectuées pour la création de la base de donnée.

-- Création de la base de donnée
CREATE DATABASE GESTION_DE_STOCK
-- Création des tables
-- Table de clients ----------------------------------------------------------------------------
CREATE TABLE Client
(
ID_CLIENT INT NOT NULL IDENTITY(1,1), --ajouter automatiquement
Nom_CLient nvarchar (250) NOT NULL,
Prenom_Client nvarchar (250) NOT NULL,
Adresse_client nvarchar (250) NOT NULL,
Telephone_client nvarchar (250) NOT NULL,
Ville_client nvarchar (250) NOT NULL,
--clée primaire 
CONSTRAINT PK_Client PRIMARY KEY(ID_CLIENT)
)
--table produit ----------------------------------------------------------------------------
CREATE TABLE Produit
(
ID_PRODUIT int NOT NULL IDENTITY(1,1),
ID_CATEGORIE int NOT NULL, --clée étrangère de la table catégorie
Nom_Produit nvarchar(250) NOT NULL,
Quantite_Produit int NOT NULL,
Prix_Produit nvarchar(250) NOT NULL,
Image_Produit IMAGE Not NULL,
--clée primaire
Constraint PK_Produit PRIMARY KEY(ID_PRODUIT)
)
--table catégorie ----------------------------------------------------------------------------
CREATE TABLE Categorie
(
ID_CATEGORIE int NOT NULL IDENTITY(1,1),
Nom_Categorie nvarchar(250) NOT NULL,
--clée primaire
CONSTRAINT PK_CATEGORIE PRIMARY KEY(ID_CATEGORIE)
)
--table commande ----------------------------------------------------------------------------
CREATE TABLE Commande
(
ID_COMMANDE int NOT NULL IDENTITY(1,1),
Date_Commande DATETIME NOT NULL,
------
ID_Client int NOT NULL, --clée étrangère de table client
--clée primaire
CONSTRAINT PK_Commande PRIMARY KEY(ID_COMMANDE)
)
--table details commande ----------------------------------------------------------------------------
CREATE TABLE Details_Commande
(
ID_COMMANDE int NOT NULL, --clée étrangère de table commande
ID_PRODUIT int NOT NULL, --clée étrangère de table produit
Quantite int NOT NULL
)
--Table Utilisateur
Create TABLE Utilisateur
(
Nom_Utilisateur nvarchar(250) NOT NULL,
Mot_De_Passe nvarchar(250),
--clée primaire
CONSTRAINT PK_Utilisateur PRIMARY KEY(Nom_Utilisateur)
)