SlideShare a Scribd company logo
1 of 8
BY
Ms V.VENNILA MCA., M.Phil..,
Assistant Professor
Bon Secours College for Women, Thanjavur.
Data Definition:
 Data definition refers to the set of SQL commands that
can create and manipulate the structures of a database.
 DDL statements are used to create, change and remove
objects including indexes, triggers, tables and views.
 Common DDL statements include
 CREATE
(generates a new table)
 ALTER
(alters table)
 DROP
(removes a table from the database)
CREATE:
Syntax:
CREATE TABLE table name(column definitions,table
parameters);
Example:
CREATE TABLE Employee(employee ID integer primary
key, first name char(50),last name(75))
ALTER:
Syntax:
ALTER object type, object name parameters
Example:
ALTER TABLE Employee ADD DOB date
Drop:
Syntax:
DROP object type object name
Example:
DROP TABLE Employee
BASIC STRUCTURE OF SQL QUERIES
 SQL is based on set relational operations with
certain modification and enhancements.
 A typical SQL query has the form
 The Select clause
 The From clause
 The Where clause
The SELECT clause:
 The select clause list the attributes described in the
result of a query.
 SQL allows duplicates in relations as well as in query
results.
 The select clause can contain arithmetic expressions
involving the operation +,-,* and / operating on
constants o attributes of tuples.
The WHERE clause:
 The where clause specifies conditions that the result
must satisfy.
 Comparison results can be combined using the logical
connectives and, or, not.
 Comparison can be applied to results of arithmetic
expressions.
The FROM clause:
 The from clause is a source of a row set to be operated
upon in a data manipulation language(DML) statement.
The from is an SQL reserved word in the SQL standard.
 The from clause is used in conjunction with SQL
statements.
SET OPERATIONS IN SQL
 SQL supports few set operations which can be performed
on the table data.
 These are used to get meaningful results from data
stored in the table under different special conditions.
Types of set operations:
 Union
 Union all
 Intersect
 Minus
Union Operation:
Union is used to combine the results of two or more
select statements.
Union All:
This operation is similar to union but it also shows the
duplicate rows.
Intersect:
Intersect operation is used to combine two select
statements.
Minus:
The minus operation combines results of two select
statements and return only those in the final result which
belongs to the first set of the result.

More Related Content

What's hot

1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
koolkampus
 

What's hot (20)

Rdbms
RdbmsRdbms
Rdbms
 
SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
trigger dbms
trigger dbmstrigger dbms
trigger dbms
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with ExamplesDML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 
Relational model
Relational modelRelational model
Relational model
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
Types Of Keys in DBMS
Types Of Keys in DBMSTypes Of Keys in DBMS
Types Of Keys in DBMS
 
Trigger
TriggerTrigger
Trigger
 
Dbms architecture
Dbms architectureDbms architecture
Dbms architecture
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
 
Sql queries presentation
Sql queries presentationSql queries presentation
Sql queries presentation
 
SQL - Structured query language introduction
SQL - Structured query language introductionSQL - Structured query language introduction
SQL - Structured query language introduction
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
 
Data independence
Data independenceData independence
Data independence
 
Aggregate function
Aggregate functionAggregate function
Aggregate function
 
DML Commands
DML CommandsDML Commands
DML Commands
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMS
 
Database architecture
Database architectureDatabase architecture
Database architecture
 

Similar to STRUCTURE OF SQL QUERIES

SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functions
Vikas Gupta
 
Structure query language (sql)
Structure query language (sql)Structure query language (sql)
Structure query language (sql)
Nalina Kumari
 

Similar to STRUCTURE OF SQL QUERIES (20)

SQL Query
SQL QuerySQL Query
SQL Query
 
PPT of Common Table Expression (CTE), Window Functions, JOINS, SubQuery
PPT  of Common Table Expression (CTE), Window Functions, JOINS, SubQueryPPT  of Common Table Expression (CTE), Window Functions, JOINS, SubQuery
PPT of Common Table Expression (CTE), Window Functions, JOINS, SubQuery
 
DATABASE MANAGMENT SYSTEM (DBMS) AND SQL
DATABASE MANAGMENT SYSTEM (DBMS) AND SQLDATABASE MANAGMENT SYSTEM (DBMS) AND SQL
DATABASE MANAGMENT SYSTEM (DBMS) AND SQL
 
DBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptxDBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptx
 
Interview Questions.pdf
Interview Questions.pdfInterview Questions.pdf
Interview Questions.pdf
 
chapter9-SQL.pptx
chapter9-SQL.pptxchapter9-SQL.pptx
chapter9-SQL.pptx
 
Assg2 b 19121033-converted
Assg2 b 19121033-convertedAssg2 b 19121033-converted
Assg2 b 19121033-converted
 
Data Base Management System - Basic Structure of SQL Queries
Data Base Management System - Basic Structure of SQL QueriesData Base Management System - Basic Structure of SQL Queries
Data Base Management System - Basic Structure of SQL Queries
 
Database Management System DBMS -SQL queries
Database Management System DBMS -SQL queriesDatabase Management System DBMS -SQL queries
Database Management System DBMS -SQL queries
 
SQL.ppt
SQL.pptSQL.ppt
SQL.ppt
 
Advanced Sql Training
Advanced Sql TrainingAdvanced Sql Training
Advanced Sql Training
 
Data Manipulation Language.pptx
Data Manipulation Language.pptxData Manipulation Language.pptx
Data Manipulation Language.pptx
 
SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functions
 
Sql basic things
Sql basic thingsSql basic things
Sql basic things
 
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
 
Cursors, triggers, procedures
Cursors, triggers, proceduresCursors, triggers, procedures
Cursors, triggers, procedures
 
Mysql
MysqlMysql
Mysql
 
mysql.ppt
mysql.pptmysql.ppt
mysql.ppt
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
 
Structure query language (sql)
Structure query language (sql)Structure query language (sql)
Structure query language (sql)
 

More from VENNILAV6

More from VENNILAV6 (20)

WORKING WITH GRAPHICS
WORKING WITH GRAPHICSWORKING WITH GRAPHICS
WORKING WITH GRAPHICS
 
CREATING A MASTER PAGE
CREATING A MASTER PAGECREATING A MASTER PAGE
CREATING A MASTER PAGE
 
CREATING A NEW PUBLICATION IN PAGEMAKER
CREATING A NEW PUBLICATION IN PAGEMAKERCREATING A NEW PUBLICATION IN PAGEMAKER
CREATING A NEW PUBLICATION IN PAGEMAKER
 
Relational algebra
Relational algebraRelational algebra
Relational algebra
 
Joins & constraints
Joins & constraintsJoins & constraints
Joins & constraints
 
Data definition language
Data definition languageData definition language
Data definition language
 
INTERCONNECTION STRUCTURE
INTERCONNECTION STRUCTUREINTERCONNECTION STRUCTURE
INTERCONNECTION STRUCTURE
 
CACHE MEMORY
CACHE MEMORYCACHE MEMORY
CACHE MEMORY
 
Machine control flow
Machine control flowMachine control flow
Machine control flow
 
COMPUTER FUNCTIONS
COMPUTER FUNCTIONSCOMPUTER FUNCTIONS
COMPUTER FUNCTIONS
 
EXTERNAL DEVICE
EXTERNAL DEVICEEXTERNAL DEVICE
EXTERNAL DEVICE
 
CORELDRAW EXAMPLES
CORELDRAW EXAMPLESCORELDRAW EXAMPLES
CORELDRAW EXAMPLES
 
BASICS OF DATA STRUCTURE
BASICS OF DATA STRUCTUREBASICS OF DATA STRUCTURE
BASICS OF DATA STRUCTURE
 
object oriented system development
object oriented system development object oriented system development
object oriented system development
 
virtual function
virtual functionvirtual function
virtual function
 
constructor and destructor
constructor and destructorconstructor and destructor
constructor and destructor
 
INHERITANCE
INHERITANCEINHERITANCE
INHERITANCE
 
BASICS OF MOBILE COMPUTING
BASICS OF MOBILE COMPUTINGBASICS OF MOBILE COMPUTING
BASICS OF MOBILE COMPUTING
 
BASICS OF JAVA
BASICS OF JAVABASICS OF JAVA
BASICS OF JAVA
 
Introduction to JAVA
Introduction to JAVAIntroduction to JAVA
Introduction to JAVA
 

Recently uploaded

Recently uploaded (20)

Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food Additives
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 

STRUCTURE OF SQL QUERIES

  • 1. BY Ms V.VENNILA MCA., M.Phil.., Assistant Professor Bon Secours College for Women, Thanjavur.
  • 2. Data Definition:  Data definition refers to the set of SQL commands that can create and manipulate the structures of a database.  DDL statements are used to create, change and remove objects including indexes, triggers, tables and views.  Common DDL statements include  CREATE (generates a new table)  ALTER (alters table)  DROP (removes a table from the database)
  • 3. CREATE: Syntax: CREATE TABLE table name(column definitions,table parameters); Example: CREATE TABLE Employee(employee ID integer primary key, first name char(50),last name(75)) ALTER: Syntax: ALTER object type, object name parameters Example: ALTER TABLE Employee ADD DOB date
  • 4. Drop: Syntax: DROP object type object name Example: DROP TABLE Employee BASIC STRUCTURE OF SQL QUERIES  SQL is based on set relational operations with certain modification and enhancements.  A typical SQL query has the form  The Select clause  The From clause  The Where clause
  • 5. The SELECT clause:  The select clause list the attributes described in the result of a query.  SQL allows duplicates in relations as well as in query results.  The select clause can contain arithmetic expressions involving the operation +,-,* and / operating on constants o attributes of tuples. The WHERE clause:  The where clause specifies conditions that the result must satisfy.  Comparison results can be combined using the logical connectives and, or, not.  Comparison can be applied to results of arithmetic expressions.
  • 6. The FROM clause:  The from clause is a source of a row set to be operated upon in a data manipulation language(DML) statement. The from is an SQL reserved word in the SQL standard.  The from clause is used in conjunction with SQL statements. SET OPERATIONS IN SQL  SQL supports few set operations which can be performed on the table data.  These are used to get meaningful results from data stored in the table under different special conditions.
  • 7. Types of set operations:  Union  Union all  Intersect  Minus Union Operation: Union is used to combine the results of two or more select statements. Union All: This operation is similar to union but it also shows the duplicate rows. Intersect: Intersect operation is used to combine two select statements.
  • 8. Minus: The minus operation combines results of two select statements and return only those in the final result which belongs to the first set of the result.