SlideShare a Scribd company logo
4
SQL is a Standard - BUT.... Although SQL is an ANSI (American National Standards Institute) standard, there are many different versions of the SQL language. However, to be compliant with the ANSI standard, they all support at least the major commands (such as SELECT, UPDATE, DELETE, INSERT, WHERE) in a similar manner.
Most read
10
SELECT * Example Now we want to select  all  the columns from the "Persons" table. We use the following SELECT statement:  SELECT * FROM Persons  Tip:  The asterisk (*) is a quick way of selecting all columns! The result-set will look like this: P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
Most read
11
SQL UPDATE Statement The UPDATE statement is used to update existing records in a table. SQL UPDATE Syntax UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value  Note:  Notice the WHERE clause in the UPDATE syntax. The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause, all records will be updated!
Most read
SQL – Structured Query Language By: - Vikash Pandey Roll No: - 43 Bhavan’s Institute of Mgmt. Science 2008-2010
What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases. SQL is an ANSI (American National Standards Institute) standard.
What Can SQL do? SQL can execute queries against a database. SQL can retrieve data from a database. SQL can insert records in a database. SQL can update records in a database. SQL can delete records from a database. SQL can create new databases. SQL can create new tables in a database. SQL can create stored procedures in a database. SQL can create views in a database. SQL can set permissions on tables, procedures, and views.
SQL is a Standard - BUT.... Although SQL is an ANSI (American National Standards Institute) standard, there are many different versions of the SQL language. However, to be compliant with the ANSI standard, they all support at least the major commands (such as SELECT, UPDATE, DELETE, INSERT, WHERE) in a similar manner.
SQL DML & DDL SQL can be divided into two parts: The Data Manipulation Language (DML) and the Data Definition Language (DDL). The query and update commands form the DML part of SQL: SELECT  - extracts data from a database UPDATE  - updates data in a database DELETE  - deletes data from a database INSERT INTO  - inserts new data into a database
The DDL part of SQL permits database tables to be created or deleted. It also define indexes (keys), specify links between tables, and impose constraints between tables. The most important DDL statements in SQL are: CREATE DATABASE  - creates a new database ALTER DATABASE  - modifies a database CREATE TABLE  - creates a new table ALTER TABLE  - modifies a table DROP TABLE  - deletes a table CREATE INDEX  - creates an index (search key) DROP INDEX  - deletes an index
The SQL SELECT Statement The SELECT statement is used to select data from a database. The result is stored in a result table, called the result-set. SQL SELECT Syntax SELECT column_name(s) FROM table_name and SELECT * FROM table_name Note:  SQL is not case sensitive. SELECT is the same as select
Example: - Now we want to select the content of the columns named "LastName" and "FirstName" from the table above. We use the following SELECT statement: SELECT LastName,FirstName FROM Persons The result-set will look like this: P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
Last Name First Name Das Sirsendu Ray Roshni Banerjee Saurav
SELECT * Example Now we want to select  all  the columns from the "Persons" table. We use the following SELECT statement:  SELECT * FROM Persons  Tip:  The asterisk (*) is a quick way of selecting all columns! The result-set will look like this: P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
SQL UPDATE Statement The UPDATE statement is used to update existing records in a table. SQL UPDATE Syntax UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value  Note:  Notice the WHERE clause in the UPDATE syntax. The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause, all records will be updated!
Example: - We use the following SQL statement: Now we want to update the person “Sinha, Joyeeti" in the "Persons" table. UPDATE Persons SET Address=‘Ernakulam', City=‘Chennai’ WHERE LastName=‘Sinha' AND FirstName='Joyeeti' P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti
The "Persons" table will now look like this: P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai
SQL DELETE Statement The DELETE statement is used to delete rows in a table. SQL DELETE Syntax DELETE FROM table_name WHERE some_column=some_value  Note:  Notice the WHERE clause in the DELETE syntax. The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records will be deleted!
Example: - We use the following SQL statement: Now we want to delete the person “Sinha, Joyeeti" in the "Persons" table. DELETE FROM Persons WHERE LastName=‘Sinha' AND FirstName='Joyeeti' P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai
It is possible to delete all rows in a table without deleting the table. This means that the table structure, attributes, and indexes will be intact: DELETE FROM table_name or DELETE * FROM table_name P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
SQL INSERT INTO Statement The INSERT INTO statement is used to insert a new row in a table. SQL INSERT INTO Syntax It is possible to write the INSERT INTO statement in two forms.  The first form doesn't specify the column names where the data will be inserted, only their values: INSERT INTO table_name VALUES (value1, value2, value3,...) The second form specifies both the column names and the values to be inserted: INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...)
Example We have the following “Persons” table: - Now we want to insert a new row in the "Persons" table. We use the following SQL statement: INSERT INTO Persons VALUES (4,‘Sinha', 'Joyeeti', ‘Ernakulam', ‘Chennai') P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
The table would look like: - P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai
INSERT Data Only In Specified Columns It is also possible to only add data in specific columns. The following SQL statement will add a new row, but only add data in the "P_Id", "LastName" and the "FirstName" columns: INSERT INTO Persons (P_Id, LastName, FirstName) VALUES (5, ‘Das', ‘Kaustav') P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai 5 Das Kaustav

More Related Content

What's hot (20)

Creating Views - oracle database
Creating Views - oracle databaseCreating Views - oracle database
Creating Views - oracle database
Salman Memon
 
Basic sql Commands
Basic sql CommandsBasic sql Commands
Basic sql Commands
MUHAMMED MASHAHIL PUKKUNNUMMAL
 
SQL Functions and Operators
SQL Functions and OperatorsSQL Functions and Operators
SQL Functions and Operators
Mohan Kumar.R
 
SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
Ritwik Das
 
Sql - Structured Query Language
Sql - Structured Query LanguageSql - Structured Query Language
Sql - Structured Query Language
Wan Hussain Wan Ishak
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
Eddyzulham Mahluzydde
 
Sql commands
Sql commandsSql commands
Sql commands
Prof. Dr. K. Adisesha
 
Sql joins
Sql joinsSql joins
Sql joins
Berkeley
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
Nishant Munjal
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
Sachidananda M H
 
Introduction to database & sql
Introduction to database & sqlIntroduction to database & sql
Introduction to database & sql
zahid6
 
Sql and Sql commands
Sql and Sql commandsSql and Sql commands
Sql and Sql commands
Knowledge Center Computer
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
Rumman Ansari
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
Shrija Madhu
 
Creating and Managing Tables -Oracle Data base
Creating and Managing Tables -Oracle Data base Creating and Managing Tables -Oracle Data base
Creating and Managing Tables -Oracle Data base
Salman Memon
 
SQL commands
SQL commandsSQL commands
SQL commands
GirdharRatne
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
Sharad Dubey
 
SQL Constraints
SQL ConstraintsSQL Constraints
SQL Constraints
Randy Riness @ South Puget Sound Community College
 
Constraints In Sql
Constraints In SqlConstraints In Sql
Constraints In Sql
Anurag
 
12 SQL
12 SQL12 SQL
12 SQL
Praveen M Jigajinni
 

Viewers also liked (20)

Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Beat Signer
 
Sql
SqlSql
Sql
ftz 420
 
Wordpress developers new york
Wordpress developers new yorkWordpress developers new york
Wordpress developers new york
Bhupendra Rajput
 
UML perusteet
UML perusteetUML perusteet
UML perusteet
Pasi Kellokoski
 
T-121.5300 Käyttoliittymasuunnittelu - Mallit
T-121.5300 Käyttoliittymasuunnittelu - MallitT-121.5300 Käyttoliittymasuunnittelu - Mallit
T-121.5300 Käyttoliittymasuunnittelu - Mallit
mniemi
 
Innovative ICT Based Library Services
Innovative ICT Based Library ServicesInnovative ICT Based Library Services
Innovative ICT Based Library Services
Glob@l Libraries - Bulgaria Program
 
Web based database application design using vb.net and sql server
Web based database application design using vb.net and sql serverWeb based database application design using vb.net and sql server
Web based database application design using vb.net and sql server
Ammara Arooj
 
[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11
AnusAhmad
 
Sql insert statement
Sql insert statementSql insert statement
Sql insert statement
Vivek Singh
 
6. triggers
6. triggers6. triggers
6. triggers
Amrit Kaur
 
Sql create table statement
Sql create table statementSql create table statement
Sql create table statement
Vivek Singh
 
SAP HANA - Manually to insert_data_table
SAP HANA - Manually to insert_data_tableSAP HANA - Manually to insert_data_table
SAP HANA - Manually to insert_data_table
Yasmin Ashraf
 
Sql wksht-7
Sql wksht-7Sql wksht-7
Sql wksht-7
Mukesh Tekwani
 
Sql commands
Sql commandsSql commands
Sql commands
Balakumaran Arunachalam
 
Part 15 triggerr
Part 15  triggerrPart 15  triggerr
Part 15 triggerr
Denny Yahya
 
Sql update statement
Sql update statementSql update statement
Sql update statement
Vivek Singh
 
Sql delete, truncate, drop statements
Sql delete, truncate, drop statementsSql delete, truncate, drop statements
Sql delete, truncate, drop statements
Vivek Singh
 
Database presentation
Database presentationDatabase presentation
Database presentation
webhostingguy
 
PL/SQL Code for Sample Projects
PL/SQL Code for Sample ProjectsPL/SQL Code for Sample Projects
PL/SQL Code for Sample Projects
jwjablonski
 
Oracle Database Trigger
Oracle Database TriggerOracle Database Trigger
Oracle Database Trigger
Eryk Budi Pratama
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Beat Signer
 
Wordpress developers new york
Wordpress developers new yorkWordpress developers new york
Wordpress developers new york
Bhupendra Rajput
 
T-121.5300 Käyttoliittymasuunnittelu - Mallit
T-121.5300 Käyttoliittymasuunnittelu - MallitT-121.5300 Käyttoliittymasuunnittelu - Mallit
T-121.5300 Käyttoliittymasuunnittelu - Mallit
mniemi
 
Web based database application design using vb.net and sql server
Web based database application design using vb.net and sql serverWeb based database application design using vb.net and sql server
Web based database application design using vb.net and sql server
Ammara Arooj
 
[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11
AnusAhmad
 
Sql insert statement
Sql insert statementSql insert statement
Sql insert statement
Vivek Singh
 
Sql create table statement
Sql create table statementSql create table statement
Sql create table statement
Vivek Singh
 
SAP HANA - Manually to insert_data_table
SAP HANA - Manually to insert_data_tableSAP HANA - Manually to insert_data_table
SAP HANA - Manually to insert_data_table
Yasmin Ashraf
 
Part 15 triggerr
Part 15  triggerrPart 15  triggerr
Part 15 triggerr
Denny Yahya
 
Sql update statement
Sql update statementSql update statement
Sql update statement
Vivek Singh
 
Sql delete, truncate, drop statements
Sql delete, truncate, drop statementsSql delete, truncate, drop statements
Sql delete, truncate, drop statements
Vivek Singh
 
Database presentation
Database presentationDatabase presentation
Database presentation
webhostingguy
 
PL/SQL Code for Sample Projects
PL/SQL Code for Sample ProjectsPL/SQL Code for Sample Projects
PL/SQL Code for Sample Projects
jwjablonski
 
Ad

Similar to Sql – Structured Query Language (20)

SQL Notes
SQL NotesSQL Notes
SQL Notes
JitendraYadav351971
 
MS SQL Server 1
MS SQL Server 1MS SQL Server 1
MS SQL Server 1
Iblesoft
 
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDSORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
Newyorksys.com
 
Sql
SqlSql
Sql
Archana Rout
 
CE 279 - WRITING SQL QUERIES umat edition.ppt
CE 279 - WRITING SQL QUERIES umat edition.pptCE 279 - WRITING SQL QUERIES umat edition.ppt
CE 279 - WRITING SQL QUERIES umat edition.ppt
minusahsaaka
 
Learning sql from w3schools
Learning sql from w3schoolsLearning sql from w3schools
Learning sql from w3schools
farhan516
 
Sql basic things
Sql basic thingsSql basic things
Sql basic things
Nishil Jain
 
SQl data base management and design
SQl     data base management  and designSQl     data base management  and design
SQl data base management and design
franckelsania20
 
SQL. It education ppt for reference sql process coding
SQL. It education ppt for reference  sql process codingSQL. It education ppt for reference  sql process coding
SQL. It education ppt for reference sql process coding
aditipandey498628
 
Sql
SqlSql
Sql
pratik201289
 
Unit - II.pptx
Unit - II.pptxUnit - II.pptx
Unit - II.pptx
MrsSavitaKumbhare
 
UNIT2.ppt
UNIT2.pptUNIT2.ppt
UNIT2.ppt
SaurabhLokare1
 
SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
PavithSingh
 
SQL Tutorial for Beginners
SQL Tutorial for BeginnersSQL Tutorial for Beginners
SQL Tutorial for Beginners
Abdelhay Shafi
 
chapter 8 SQL.ppt
chapter 8 SQL.pptchapter 8 SQL.ppt
chapter 8 SQL.ppt
YitbarekMurche
 
SQL notes 1.pdf
SQL notes 1.pdfSQL notes 1.pdf
SQL notes 1.pdf
JitendraYadav351971
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
farwa waqar
 
DML Statements.pptx
DML Statements.pptxDML Statements.pptx
DML Statements.pptx
UnitedGamer1
 
SQL Language
SQL LanguageSQL Language
SQL Language
Baker Ahimbisibwe
 
Introduction to sql
Introduction to sqlIntroduction to sql
Introduction to sql
SARVESH KUMAR
 
MS SQL Server 1
MS SQL Server 1MS SQL Server 1
MS SQL Server 1
Iblesoft
 
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDSORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
Newyorksys.com
 
CE 279 - WRITING SQL QUERIES umat edition.ppt
CE 279 - WRITING SQL QUERIES umat edition.pptCE 279 - WRITING SQL QUERIES umat edition.ppt
CE 279 - WRITING SQL QUERIES umat edition.ppt
minusahsaaka
 
Learning sql from w3schools
Learning sql from w3schoolsLearning sql from w3schools
Learning sql from w3schools
farhan516
 
Sql basic things
Sql basic thingsSql basic things
Sql basic things
Nishil Jain
 
SQl data base management and design
SQl     data base management  and designSQl     data base management  and design
SQl data base management and design
franckelsania20
 
SQL. It education ppt for reference sql process coding
SQL. It education ppt for reference  sql process codingSQL. It education ppt for reference  sql process coding
SQL. It education ppt for reference sql process coding
aditipandey498628
 
SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
PavithSingh
 
SQL Tutorial for Beginners
SQL Tutorial for BeginnersSQL Tutorial for Beginners
SQL Tutorial for Beginners
Abdelhay Shafi
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
farwa waqar
 
DML Statements.pptx
DML Statements.pptxDML Statements.pptx
DML Statements.pptx
UnitedGamer1
 
Ad

Recently uploaded (20)

How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18
Celine George
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
Quiz Club of PSG College of Arts & Science
 
How to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 WebsiteHow to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 Website
Celine George
 
Uterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managmentUterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managment
Ritu480198
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
Search Engine Optimization (SEO) for Website Success
Search Engine Optimization (SEO) for Website SuccessSearch Engine Optimization (SEO) for Website Success
Search Engine Optimization (SEO) for Website Success
Muneeb Rana
 
State institute of educational technology
State institute of educational technologyState institute of educational technology
State institute of educational technology
vp5806484
 
Semisolid_Dosage_Forms.pptx
Semisolid_Dosage_Forms.pptxSemisolid_Dosage_Forms.pptx
Semisolid_Dosage_Forms.pptx
Shantanu Ranjan
 
How to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time OffHow to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time Off
Celine George
 
AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...
AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...
AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...
Mani Sasidharan
 
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdfপ্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
Pragya - UEM Kolkata Quiz Club
 
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptxWRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
Sourav Kr Podder
 
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDMMIA Reiki Yoga S8 Free Workshop Grad LevelLDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDM & Mia eStudios
 
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
Quiz Club of PSG College of Arts & Science
 
Pragya Champion's Chalice 2025 Set , General Quiz
Pragya Champion's Chalice 2025 Set , General QuizPragya Champion's Chalice 2025 Set , General Quiz
Pragya Champion's Chalice 2025 Set , General Quiz
Pragya - UEM Kolkata Quiz Club
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
How to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time OffHow to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time Off
Celine George
 
Pharmaceutical_Incompatibilities.pptx
Pharmaceutical_Incompatibilities.pptxPharmaceutical_Incompatibilities.pptx
Pharmaceutical_Incompatibilities.pptx
Shantanu Ranjan
 
Rose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdfRose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdf
kushallamichhame
 
How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18
Celine George
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
How to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 WebsiteHow to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 Website
Celine George
 
Uterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managmentUterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managment
Ritu480198
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
Search Engine Optimization (SEO) for Website Success
Search Engine Optimization (SEO) for Website SuccessSearch Engine Optimization (SEO) for Website Success
Search Engine Optimization (SEO) for Website Success
Muneeb Rana
 
State institute of educational technology
State institute of educational technologyState institute of educational technology
State institute of educational technology
vp5806484
 
Semisolid_Dosage_Forms.pptx
Semisolid_Dosage_Forms.pptxSemisolid_Dosage_Forms.pptx
Semisolid_Dosage_Forms.pptx
Shantanu Ranjan
 
How to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time OffHow to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time Off
Celine George
 
AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...
AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...
AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...
Mani Sasidharan
 
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdfপ্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
Pragya - UEM Kolkata Quiz Club
 
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptxWRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
Sourav Kr Podder
 
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDMMIA Reiki Yoga S8 Free Workshop Grad LevelLDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDM & Mia eStudios
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
How to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time OffHow to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time Off
Celine George
 
Pharmaceutical_Incompatibilities.pptx
Pharmaceutical_Incompatibilities.pptxPharmaceutical_Incompatibilities.pptx
Pharmaceutical_Incompatibilities.pptx
Shantanu Ranjan
 
Rose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdfRose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdf
kushallamichhame
 

Sql – Structured Query Language

  • 1. SQL – Structured Query Language By: - Vikash Pandey Roll No: - 43 Bhavan’s Institute of Mgmt. Science 2008-2010
  • 2. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases. SQL is an ANSI (American National Standards Institute) standard.
  • 3. What Can SQL do? SQL can execute queries against a database. SQL can retrieve data from a database. SQL can insert records in a database. SQL can update records in a database. SQL can delete records from a database. SQL can create new databases. SQL can create new tables in a database. SQL can create stored procedures in a database. SQL can create views in a database. SQL can set permissions on tables, procedures, and views.
  • 4. SQL is a Standard - BUT.... Although SQL is an ANSI (American National Standards Institute) standard, there are many different versions of the SQL language. However, to be compliant with the ANSI standard, they all support at least the major commands (such as SELECT, UPDATE, DELETE, INSERT, WHERE) in a similar manner.
  • 5. SQL DML & DDL SQL can be divided into two parts: The Data Manipulation Language (DML) and the Data Definition Language (DDL). The query and update commands form the DML part of SQL: SELECT - extracts data from a database UPDATE - updates data in a database DELETE - deletes data from a database INSERT INTO - inserts new data into a database
  • 6. The DDL part of SQL permits database tables to be created or deleted. It also define indexes (keys), specify links between tables, and impose constraints between tables. The most important DDL statements in SQL are: CREATE DATABASE - creates a new database ALTER DATABASE - modifies a database CREATE TABLE - creates a new table ALTER TABLE - modifies a table DROP TABLE - deletes a table CREATE INDEX - creates an index (search key) DROP INDEX - deletes an index
  • 7. The SQL SELECT Statement The SELECT statement is used to select data from a database. The result is stored in a result table, called the result-set. SQL SELECT Syntax SELECT column_name(s) FROM table_name and SELECT * FROM table_name Note: SQL is not case sensitive. SELECT is the same as select
  • 8. Example: - Now we want to select the content of the columns named "LastName" and "FirstName" from the table above. We use the following SELECT statement: SELECT LastName,FirstName FROM Persons The result-set will look like this: P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
  • 9. Last Name First Name Das Sirsendu Ray Roshni Banerjee Saurav
  • 10. SELECT * Example Now we want to select all the columns from the "Persons" table. We use the following SELECT statement:  SELECT * FROM Persons Tip: The asterisk (*) is a quick way of selecting all columns! The result-set will look like this: P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
  • 11. SQL UPDATE Statement The UPDATE statement is used to update existing records in a table. SQL UPDATE Syntax UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value Note: Notice the WHERE clause in the UPDATE syntax. The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause, all records will be updated!
  • 12. Example: - We use the following SQL statement: Now we want to update the person “Sinha, Joyeeti" in the "Persons" table. UPDATE Persons SET Address=‘Ernakulam', City=‘Chennai’ WHERE LastName=‘Sinha' AND FirstName='Joyeeti' P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti
  • 13. The "Persons" table will now look like this: P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai
  • 14. SQL DELETE Statement The DELETE statement is used to delete rows in a table. SQL DELETE Syntax DELETE FROM table_name WHERE some_column=some_value Note: Notice the WHERE clause in the DELETE syntax. The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records will be deleted!
  • 15. Example: - We use the following SQL statement: Now we want to delete the person “Sinha, Joyeeti" in the "Persons" table. DELETE FROM Persons WHERE LastName=‘Sinha' AND FirstName='Joyeeti' P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai
  • 16. It is possible to delete all rows in a table without deleting the table. This means that the table structure, attributes, and indexes will be intact: DELETE FROM table_name or DELETE * FROM table_name P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
  • 17. SQL INSERT INTO Statement The INSERT INTO statement is used to insert a new row in a table. SQL INSERT INTO Syntax It is possible to write the INSERT INTO statement in two forms. The first form doesn't specify the column names where the data will be inserted, only their values: INSERT INTO table_name VALUES (value1, value2, value3,...) The second form specifies both the column names and the values to be inserted: INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...)
  • 18. Example We have the following “Persons” table: - Now we want to insert a new row in the "Persons" table. We use the following SQL statement: INSERT INTO Persons VALUES (4,‘Sinha', 'Joyeeti', ‘Ernakulam', ‘Chennai') P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
  • 19. The table would look like: - P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai
  • 20. INSERT Data Only In Specified Columns It is also possible to only add data in specific columns. The following SQL statement will add a new row, but only add data in the "P_Id", "LastName" and the "FirstName" columns: INSERT INTO Persons (P_Id, LastName, FirstName) VALUES (5, ‘Das', ‘Kaustav') P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai 5 Das Kaustav

Editor's Notes

  • #5: Note: Most of the SQL database programs also have their own proprietary extensions in addition to the SQL standard!