SlideShare a Scribd company logo
SQL
SQL
• SQL – Structured Query Language
• You can use SQL for:
• Running queries in a database
• Retrieve data from the database
• Insert/update and delete records in a database
SQL SELECT *
• To see all records from a certain table in a database:
• SELECT * FROM table_name;
SQL SELECT *
Example
From the table Teachers:
• SELECT * FROM Teacher;
Name Number TutorGroup Subject
Mrs Smith Ext 247 4T1 Maths
Mr Charles Ext 372 2R1 CDT
Miss Kensington Ext 121 1R1 Computing
Dr Wright Ext 450 3B2 Science
Mrs Grey Ext 449 4R1 English
Mr Temple Ext 102 2B1 Maths
Mrs Cloud Ext 546 5T1 French
Mr Stewart Ext 631 6T1 Computing
Mrs Thomas Ext 518 1B2 PE
Mr Singleton Ext 712 6R1 Art
SQL SELECT - ORDER BY
• To see certain records from a table in a database:
• SELECT column_names FROM table_name;
SQL SELECT - ORDER BY
Example
• SELECT Name, Subject FROM Teachers;
• Answer:
Name Number TutorGroup Subject
Mrs Smith Ext 247 4T1 Maths
Mr Charles Ext 372 2R1 CDT
Miss Kensington Ext 121 1R1 Computing
Dr Wright Ext 450 3B2 Science
Mrs Grey Ext 449 4R1 English
Mr Temple Ext 102 2B1 Maths
Mrs Cloud Ext 546 5T1 French
Mr Stewart Ext 631 6T1 Computing
Mrs Thomas Ext 518 1B2 PE
Mr Singleton Ext 712 6R1 Art
Name Subject
Mrs Smith Maths
Mr Charles CDT
Miss Kensington Computing
Dr Wright Science
Mrs Grey English
Mr Temple Maths
Mrs Cloud French
Mr Stewart Computing
Mrs Thomas PE
Mr Singleton Art
SQL DELETE
• To delete a record from a table :
• DELETE FROM table_name WHERE condition;
SQL DELETE
Example
• DELETE FROM Teachers WHERE Name = ‘Dr Wright’;
• Answer:
Name Number TutorGroup Subject
Mrs Smith Ext 247 4T1 Maths
Mr Charles Ext 372 2R1 CDT
Miss Kensington Ext 121 1R1 Computing
Dr Wright Ext 450 3B2 Science
Mrs Grey Ext 449 4R1 English
Mr Temple Ext 102 2B1 Maths
Mrs Cloud Ext 546 5T1 French
Mr Stewart Ext 631 6T1 Computing
Mrs Thomas Ext 518 1B2 PE
Mr Singleton Ext 712 6R1 Art
Name Number TutorGroup Subject
Mrs Smith Ext 247 4T1 Maths
Mr Charles Ext 372 2R1 CDT
Miss
Kensington
Ext 121 1R1 Computing
Mrs Grey Ext 449 4R1 English
Mr Temple Ext 102 2B1 Maths
Mrs Cloud Ext 546 5T1 French
Mr Stewart Ext 631 6T1 Computing
Mrs Thomas Ext 518 1B2 PE
Mr Singleton Ext 712 6R1 Art

More Related Content

More from SabahtHussein

Introduction to Pseudocode
Introduction to PseudocodeIntroduction to Pseudocode
Introduction to Pseudocode
SabahtHussein
 
Query Design
Query DesignQuery Design
Query Design
SabahtHussein
 
SQL PT
SQL PTSQL PT
Query design
Query designQuery design
Query design
SabahtHussein
 
S3 Field Types
S3 Field TypesS3 Field Types
S3 Field Types
SabahtHussein
 
Testing a Database
Testing a DatabaseTesting a Database
Testing a Database
SabahtHussein
 
Testing a Database
Testing a DatabaseTesting a Database
Testing a Database
SabahtHussein
 
Database Testing and Evaluation
Database Testing and EvaluationDatabase Testing and Evaluation
Database Testing and Evaluation
SabahtHussein
 
DPA and GDPR
DPA and GDPRDPA and GDPR
DPA and GDPR
SabahtHussein
 
Database Analysis
Database AnalysisDatabase Analysis
Database Analysis
SabahtHussein
 
Database Analysis
Database AnalysisDatabase Analysis
Database Analysis
SabahtHussein
 
Green technology
Green technologyGreen technology
Green technology
SabahtHussein
 
Html lesson1 5
Html lesson1 5Html lesson1 5
Html lesson1 5
SabahtHussein
 
Database Analysis
Database AnalysisDatabase Analysis
Database Analysis
SabahtHussein
 
Kodu Lesson 3
Kodu Lesson 3Kodu Lesson 3
Kodu Lesson 3
SabahtHussein
 
Software Evaluation
Software EvaluationSoftware Evaluation
Software Evaluation
SabahtHussein
 
Website analysis
Website analysisWebsite analysis
Website analysis
SabahtHussein
 
Database query design
Database query designDatabase query design
Database query design
SabahtHussein
 
Software analysis
Software analysisSoftware analysis
Software analysis
SabahtHussein
 
Development methodologies
Development methodologiesDevelopment methodologies
Development methodologies
SabahtHussein
 

More from SabahtHussein (20)

Introduction to Pseudocode
Introduction to PseudocodeIntroduction to Pseudocode
Introduction to Pseudocode
 
Query Design
Query DesignQuery Design
Query Design
 
SQL PT
SQL PTSQL PT
SQL PT
 
Query design
Query designQuery design
Query design
 
S3 Field Types
S3 Field TypesS3 Field Types
S3 Field Types
 
Testing a Database
Testing a DatabaseTesting a Database
Testing a Database
 
Testing a Database
Testing a DatabaseTesting a Database
Testing a Database
 
Database Testing and Evaluation
Database Testing and EvaluationDatabase Testing and Evaluation
Database Testing and Evaluation
 
DPA and GDPR
DPA and GDPRDPA and GDPR
DPA and GDPR
 
Database Analysis
Database AnalysisDatabase Analysis
Database Analysis
 
Database Analysis
Database AnalysisDatabase Analysis
Database Analysis
 
Green technology
Green technologyGreen technology
Green technology
 
Html lesson1 5
Html lesson1 5Html lesson1 5
Html lesson1 5
 
Database Analysis
Database AnalysisDatabase Analysis
Database Analysis
 
Kodu Lesson 3
Kodu Lesson 3Kodu Lesson 3
Kodu Lesson 3
 
Software Evaluation
Software EvaluationSoftware Evaluation
Software Evaluation
 
Website analysis
Website analysisWebsite analysis
Website analysis
 
Database query design
Database query designDatabase query design
Database query design
 
Software analysis
Software analysisSoftware analysis
Software analysis
 
Development methodologies
Development methodologiesDevelopment methodologies
Development methodologies
 

Recently uploaded

ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 

Recently uploaded (20)

ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 

S3 SQL

  • 1. SQL
  • 2. SQL • SQL – Structured Query Language • You can use SQL for: • Running queries in a database • Retrieve data from the database • Insert/update and delete records in a database
  • 3. SQL SELECT * • To see all records from a certain table in a database: • SELECT * FROM table_name;
  • 4. SQL SELECT * Example From the table Teachers: • SELECT * FROM Teacher; Name Number TutorGroup Subject Mrs Smith Ext 247 4T1 Maths Mr Charles Ext 372 2R1 CDT Miss Kensington Ext 121 1R1 Computing Dr Wright Ext 450 3B2 Science Mrs Grey Ext 449 4R1 English Mr Temple Ext 102 2B1 Maths Mrs Cloud Ext 546 5T1 French Mr Stewart Ext 631 6T1 Computing Mrs Thomas Ext 518 1B2 PE Mr Singleton Ext 712 6R1 Art
  • 5. SQL SELECT - ORDER BY • To see certain records from a table in a database: • SELECT column_names FROM table_name;
  • 6. SQL SELECT - ORDER BY Example • SELECT Name, Subject FROM Teachers; • Answer: Name Number TutorGroup Subject Mrs Smith Ext 247 4T1 Maths Mr Charles Ext 372 2R1 CDT Miss Kensington Ext 121 1R1 Computing Dr Wright Ext 450 3B2 Science Mrs Grey Ext 449 4R1 English Mr Temple Ext 102 2B1 Maths Mrs Cloud Ext 546 5T1 French Mr Stewart Ext 631 6T1 Computing Mrs Thomas Ext 518 1B2 PE Mr Singleton Ext 712 6R1 Art Name Subject Mrs Smith Maths Mr Charles CDT Miss Kensington Computing Dr Wright Science Mrs Grey English Mr Temple Maths Mrs Cloud French Mr Stewart Computing Mrs Thomas PE Mr Singleton Art
  • 7. SQL DELETE • To delete a record from a table : • DELETE FROM table_name WHERE condition;
  • 8. SQL DELETE Example • DELETE FROM Teachers WHERE Name = ‘Dr Wright’; • Answer: Name Number TutorGroup Subject Mrs Smith Ext 247 4T1 Maths Mr Charles Ext 372 2R1 CDT Miss Kensington Ext 121 1R1 Computing Dr Wright Ext 450 3B2 Science Mrs Grey Ext 449 4R1 English Mr Temple Ext 102 2B1 Maths Mrs Cloud Ext 546 5T1 French Mr Stewart Ext 631 6T1 Computing Mrs Thomas Ext 518 1B2 PE Mr Singleton Ext 712 6R1 Art Name Number TutorGroup Subject Mrs Smith Ext 247 4T1 Maths Mr Charles Ext 372 2R1 CDT Miss Kensington Ext 121 1R1 Computing Mrs Grey Ext 449 4R1 English Mr Temple Ext 102 2B1 Maths Mrs Cloud Ext 546 5T1 French Mr Stewart Ext 631 6T1 Computing Mrs Thomas Ext 518 1B2 PE Mr Singleton Ext 712 6R1 Art