SlideShare une entreprise Scribd logo
1  sur  9
Les requêtes
La sélection La mie à jour
Sélection
simple Paramétrés
Regroupement
Avec
Champs
calculés
La structure Les enregistrements
A/M/S
une
colonne
Créer une
table
Supprim
er une
table
A/M/S un
enregistre
ment
• SELECT Ch1, Ch2, …. Chn , Fct_Agregation
FROM T1, T2,….Tn
WHERE Jointures/Conditions
GROUP BY Champs existant dans (Select)
HAVING Conditions sur la Fct_Agregation
• Afficher (Nom, Prénom, Quantité totale) des
vendeurs qui ont vendu une quantité totale
supérieure à 10.
• SELECT Nom, Prénom, Sum(Qte_v) as [Quantité
totale]
FROM Vendeurs , Ventes
WHERE Vendeurs.Matricule=Ventes.Matricule
GROUP BY Nom, Prénom;
HAVING Sum(Qte_v)>10
Les requêtes
La sélection La mie à jour
Sélection
simple Paramétrés
Regroupement
Avec
Champs
calculés
La structure Les enregistrements
A/M/S
une
colonne
Créer une
table
Supprim
er une
table
A/M/S un
enregistre
ment
La Structure
• Créer une table:
CREATE TABLE nom_de_la_table (
Champs1 type_donnees Primary key Not null,
Champs2 type_donnees ,
ChampsN type_donnees
ADD CONSTRAINT NomContrainte FOREIGN KEY (CH1)
REFERENCES Table2(CH2);
)
La Structure
• Les contraintes: ( clé étrangère )
ALTER TABLE NomTable
ADD CONSTRAINT NomContrainte FOREIGN KEY (CH1)
REFERENCES Table2(CH2);
• Les contraintes: ( clé primaire)
ALTER TABLE NomTable
ADD CONSTRAINT NomContrainte PRIMARY KEY (CH1);
La Structure
• Supprimer une table
Drop table NomTable;
• Supprimer une contrainte
Drop constraint NomContrainte;
La Structure
• Ajout des champs
ALTER TABLE NomTable
ADD COLUMN NomCH TYPE;
• Modification le type d’une colonne
ALTER TABLE NomTable
ALTER COLUMN NomCH TYPE;
• Suppression d’une colonne
ALTER TABLE NomTable
DROP COLUMN NomCH ;
Les Enregistrements
• Ajout d’un enregistrement:
INSERT INTO NomTable (NomCH1,NomCH2,…,NomCHN)
VALUES (ValeurCh1, ValeurCh2,…, ValeurChN);
• Modification d’un enregistrement:
UPDATE NomTable
SET NomCH=NouvelleValeur
WHERE Conditions;
• Suppression d’un enregistrement
DELETE FROM NomTable
WHERE Conditions;

Contenu connexe

En vedette

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

En vedette (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

Les requetes (1)

  • 1. Les requêtes La sélection La mie à jour Sélection simple Paramétrés Regroupement Avec Champs calculés La structure Les enregistrements A/M/S une colonne Créer une table Supprim er une table A/M/S un enregistre ment
  • 2. • SELECT Ch1, Ch2, …. Chn , Fct_Agregation FROM T1, T2,….Tn WHERE Jointures/Conditions GROUP BY Champs existant dans (Select) HAVING Conditions sur la Fct_Agregation
  • 3. • Afficher (Nom, Prénom, Quantité totale) des vendeurs qui ont vendu une quantité totale supérieure à 10. • SELECT Nom, Prénom, Sum(Qte_v) as [Quantité totale] FROM Vendeurs , Ventes WHERE Vendeurs.Matricule=Ventes.Matricule GROUP BY Nom, Prénom; HAVING Sum(Qte_v)>10
  • 4. Les requêtes La sélection La mie à jour Sélection simple Paramétrés Regroupement Avec Champs calculés La structure Les enregistrements A/M/S une colonne Créer une table Supprim er une table A/M/S un enregistre ment
  • 5. La Structure • Créer une table: CREATE TABLE nom_de_la_table ( Champs1 type_donnees Primary key Not null, Champs2 type_donnees , ChampsN type_donnees ADD CONSTRAINT NomContrainte FOREIGN KEY (CH1) REFERENCES Table2(CH2); )
  • 6. La Structure • Les contraintes: ( clé étrangère ) ALTER TABLE NomTable ADD CONSTRAINT NomContrainte FOREIGN KEY (CH1) REFERENCES Table2(CH2); • Les contraintes: ( clé primaire) ALTER TABLE NomTable ADD CONSTRAINT NomContrainte PRIMARY KEY (CH1);
  • 7. La Structure • Supprimer une table Drop table NomTable; • Supprimer une contrainte Drop constraint NomContrainte;
  • 8. La Structure • Ajout des champs ALTER TABLE NomTable ADD COLUMN NomCH TYPE; • Modification le type d’une colonne ALTER TABLE NomTable ALTER COLUMN NomCH TYPE; • Suppression d’une colonne ALTER TABLE NomTable DROP COLUMN NomCH ;
  • 9. Les Enregistrements • Ajout d’un enregistrement: INSERT INTO NomTable (NomCH1,NomCH2,…,NomCHN) VALUES (ValeurCh1, ValeurCh2,…, ValeurChN); • Modification d’un enregistrement: UPDATE NomTable SET NomCH=NouvelleValeur WHERE Conditions; • Suppression d’un enregistrement DELETE FROM NomTable WHERE Conditions;