0% found this document useful (0 votes)
4 views

Create the database (2)

The document outlines the creation of a database named 'store' and the establishment of several tables including Product, Fournisseur, Client, Fourni, and Acheter. It includes the definition of primary keys, foreign keys, and sample data insertion for each table. The document serves as a foundational setup for managing products, suppliers, clients, and transactions in the store database.

Uploaded by

khorsisamah56
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Create the database (2)

The document outlines the creation of a database named 'store' and the establishment of several tables including Product, Fournisseur, Client, Fourni, and Acheter. It includes the definition of primary keys, foreign keys, and sample data insertion for each table. The document serves as a foundational setup for managing products, suppliers, clients, and transactions in the store database.

Uploaded by

khorsisamah56
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

-- Create the database

CREATE DATABASE store;

-- Use the store database

USE store;

-- Create the Product table

CREATE TABLE Product (

Id_p INT PRIMARY KEY,

nom VARCHAR(100)

);

-- Create the Fournisseur table

CREATE TABLE Fournisseur (

Id_F INT PRIMARY KEY,

nom VARCHAR(100)

);

-- Create the Client table

CREATE TABLE Client (

Id_c INT PRIMARY KEY,

nom VARCHAR(100)

);

-- Create the Fourni table

CREATE TABLE Fourni (

ID INT PRIMARY KEY AUTO_INCREMENT,

id_p INT,

id_f INT,
quantity INT,

FOREIGN KEY (id_p) REFERENCES Product(Id_p),

FOREIGN KEY (id_f) REFERENCES Fournisseur(Id_F)

);

-- Create the Acheter table

CREATE TABLE Acheter (

ID INT PRIMARY KEY,

id_p INT,

id_c INT,

quantity INT,

FOREIGN KEY (id_p) REFERENCES Product(Id_p),

FOREIGN KEY (id_c) REFERENCES Client(Id_c)

);

-- Insert into Fournisseur table

INSERT INTO Fournisseur VALUES (66, "salah");

-- Insert into Product table

INSERT INTO Product VALUES (12, "9alm rasas");

-- Insert into Fourni table

INSERT INTO Fourni VALUES (1, 12, 66, 70);

INSERT INTO Client (Id_c, nom) VALUES (1, 'John Doe');


INSERT INTO Client (Id_c, nom) VALUES (2, 'Jane Smith')
INSERT INTO Acheter (ID, id_p, id_c, quantity) VALUES (1, 12, 1, 5); --
INSERT INTO Acheter (ID, id_p, id_c, quantity) VALUES (2, 12, 2, 10);

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy