SlideShare a Scribd company logo
1 of 25
Introduction to
SQL
UNIVERSITY OF TEHRAN
NOVEMBER, 2016
What is SQL?
 Structured Query Language
 SQL is Structured Query Language, which is a
computer language for storing, manipulating and
retrieving data stored in relational database.
 SQL is the standard language for Relation Database
System. All relational database management systems
like “MySQL, MS Access, Oracle, Sybase, Informix,
postgres and SQL Server” use SQL as standard
database language.
SQL Commands
 DDL - Data Definition Language
 DML - Data Manipulation Language
 DCL - Data Control Language
 DQL - Data Query Language
SQL Commands
SQL Commands
SQL RDBMS Concepts
 TABLE
 RECORD
 COLUMN
 CELL
 NULL?
SQL RDBMS Concepts
 SQL Constraints: (applied on columns)
 NOT NULL Constraint
 UNIQUE Constraint
 PRIMARY Key
 FOREIGN Key
 CHECK Constraint
 Data Integrity:
 Entity Integrity: There are no duplicate rows in a table
 Domain Integrity: Enforces valid entries for a given column by
restricting the type
 Referential Integrity: Rows cannot be deleted which are used by
other records
 User-Defined Integrity: Enforces some specific business rules
SQL RDBMS Concepts
 Data Types:
 Character datatypes:
 CHAR
 NCHAR
 NVARCHAR2
 VARCHAR2
 Numeric datatypes:
 NUMBER
 BINARY_FLOAT
 BINARY_DOUBLE
 Date time datatype:
 DATE
DCL: CREATE USER
 1) Define User with Username/Password
 2) Grants Sufficient Privileges.
 Using SQL Developer (UI, Command)
 Using SQL *PLUS (Command)
SQL : DDL
 Create Table:
 COLUMNS
 CONSTRAINTS
SQL: DDL
 DROP TABLE:
 ALTER TABLE
 OTHER DDL COMMANDS!!!!
SQL: DML: INSERT
 INSERT INTO:
 NUMBER, CHAR/VARCHAR2, DATE?
SQL: DML: INSERT
 INSERT INTO:
 SPECIFIC COLUMNS
SQL: DML: INSERT
 INSERT INTO:
 FOREIGN KEY
 ALL DML COMMANDS NEED COMMIT
SQL: DML: UPDATE
 UPDATE
 WHERE CLAUSE
SQL: DML: DELETE
 DELETE (DELETE VS DROP????)
HR-Schema
SQL: DQL: SELECT
 SELECT
 *
 SPECIFIC COLUMNS
SQL: DQL: SELECT
 DISTINCT CLUASE
SQL: DQL: SELECT
 WHERE CLUASE
SQL: DQL: SELECT
 IN CLUASE
 NOT IN
 NULL IN WHERE?
 IS NULL
 IS NOT NULL
SQL: DQL: SELECT
 ORDER BY
SQL: DQL: SELECT
 GROUP BY
 AGGREGATE FUCTION
 MAX,MIN
 AVG
 COUNT
 SUM
 …
 HAVING CLAUSE
SQL: DQL: SELECT
 SELECT FROM MULTIPLE TABLES
 CARTESIAN MULTIPICATION
 JOIN
About Me
 Ehsan Hamzei
 Graduate Student of Geospatial Information System
 University of Tehran
 Git-Hub: https://github.com/ehsan-hamzei/
 Source-Codes: https://github.com/ehsan-
hamzei/Oracle-SQL/

More Related Content

What's hot (20)

Javascript
JavascriptJavascript
Javascript
 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts
 
Sql queries presentation
Sql queries presentationSql queries presentation
Sql queries presentation
 
Types Of Keys in DBMS
Types Of Keys in DBMSTypes Of Keys in DBMS
Types Of Keys in DBMS
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra ppt
 
Database Management System ppt
Database Management System pptDatabase Management System ppt
Database Management System ppt
 
DATABASE CONSTRAINTS
DATABASE CONSTRAINTSDATABASE CONSTRAINTS
DATABASE CONSTRAINTS
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
1 - Introduction to PL/SQL
1 - Introduction to PL/SQL1 - Introduction to PL/SQL
1 - Introduction to PL/SQL
 
Cursors
CursorsCursors
Cursors
 
SQL commands
SQL commandsSQL commands
SQL commands
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
Data Models
Data ModelsData Models
Data Models
 
SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
 
Database language
Database languageDatabase language
Database language
 
DBMS: Types of keys
DBMS:  Types of keysDBMS:  Types of keys
DBMS: Types of keys
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 

Viewers also liked

SQL Tutorial - Basic Commands
SQL Tutorial - Basic CommandsSQL Tutorial - Basic Commands
SQL Tutorial - Basic Commands1keydata
 
Memory dbms
Memory dbmsMemory dbms
Memory dbmsTech_MX
 
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 Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 OverviewEric Nelson
 
Introduction to database & sql
Introduction to database & sqlIntroduction to database & sql
Introduction to database & sqlzahid6
 
Introduction to SQL (for Chicago Booth MBA technology club)
Introduction to SQL (for Chicago Booth MBA technology club)Introduction to SQL (for Chicago Booth MBA technology club)
Introduction to SQL (for Chicago Booth MBA technology club)Jennifer Berk
 
ITCamp 2013 - Cristian Lefter - Transact-SQL from 0 to SQL Server 2012
ITCamp 2013 - Cristian Lefter - Transact-SQL from 0 to SQL Server 2012ITCamp 2013 - Cristian Lefter - Transact-SQL from 0 to SQL Server 2012
ITCamp 2013 - Cristian Lefter - Transact-SQL from 0 to SQL Server 2012ITCamp
 
Whats New Sql Server 2008 R2
Whats New Sql Server 2008 R2Whats New Sql Server 2008 R2
Whats New Sql Server 2008 R2Eduardo Castro
 
Android App Development Tips for Beginners
Android App Development Tips for BeginnersAndroid App Development Tips for Beginners
Android App Development Tips for BeginnersZoftino
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 OverviewDavid Chou
 
Part 7 ddl dan dml lant..retriving data up
Part 7  ddl dan dml lant..retriving data upPart 7  ddl dan dml lant..retriving data up
Part 7 ddl dan dml lant..retriving data upDenny Yahya
 
Fundamentals of database system - Database System Concepts and Architecture
Fundamentals of database system - Database System Concepts and ArchitectureFundamentals of database system - Database System Concepts and Architecture
Fundamentals of database system - Database System Concepts and ArchitectureMustafa Kamel Mohammadi
 
retrieving data using SQL statements
retrieving data using SQL statementsretrieving data using SQL statements
retrieving data using SQL statementsArun Nair
 

Viewers also liked (20)

Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
 
SQL Tutorial - Basic Commands
SQL Tutorial - Basic CommandsSQL Tutorial - Basic Commands
SQL Tutorial - Basic Commands
 
Dbms slides
Dbms slidesDbms slides
Dbms slides
 
Memory dbms
Memory dbmsMemory dbms
Memory dbms
 
SQL : introduction
SQL : introductionSQL : introduction
SQL : introduction
 
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...
 
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 Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 Overview
 
Introduction to database & sql
Introduction to database & sqlIntroduction to database & sql
Introduction to database & sql
 
Introduction to SQL (for Chicago Booth MBA technology club)
Introduction to SQL (for Chicago Booth MBA technology club)Introduction to SQL (for Chicago Booth MBA technology club)
Introduction to SQL (for Chicago Booth MBA technology club)
 
ITCamp 2013 - Cristian Lefter - Transact-SQL from 0 to SQL Server 2012
ITCamp 2013 - Cristian Lefter - Transact-SQL from 0 to SQL Server 2012ITCamp 2013 - Cristian Lefter - Transact-SQL from 0 to SQL Server 2012
ITCamp 2013 - Cristian Lefter - Transact-SQL from 0 to SQL Server 2012
 
Whats New Sql Server 2008 R2
Whats New Sql Server 2008 R2Whats New Sql Server 2008 R2
Whats New Sql Server 2008 R2
 
Data manipulation language
Data  manipulation languageData  manipulation language
Data manipulation language
 
Normalization,ddl,dml,dcl
Normalization,ddl,dml,dclNormalization,ddl,dml,dcl
Normalization,ddl,dml,dcl
 
Android App Development Tips for Beginners
Android App Development Tips for BeginnersAndroid App Development Tips for Beginners
Android App Development Tips for Beginners
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 Overview
 
Part 7 ddl dan dml lant..retriving data up
Part 7  ddl dan dml lant..retriving data upPart 7  ddl dan dml lant..retriving data up
Part 7 ddl dan dml lant..retriving data up
 
Fundamentals of database system - Database System Concepts and Architecture
Fundamentals of database system - Database System Concepts and ArchitectureFundamentals of database system - Database System Concepts and Architecture
Fundamentals of database system - Database System Concepts and Architecture
 
DDL DML sysytems
DDL DML sysytemsDDL DML sysytems
DDL DML sysytems
 
retrieving data using SQL statements
retrieving data using SQL statementsretrieving data using SQL statements
retrieving data using SQL statements
 

Similar to Introduction to SQL (20)

SQL .pptx
SQL .pptxSQL .pptx
SQL .pptx
 
SQL2.pptx
SQL2.pptxSQL2.pptx
SQL2.pptx
 
Structured Query Language
Structured Query LanguageStructured Query Language
Structured Query Language
 
SQL 3.pptx
SQL 3.pptxSQL 3.pptx
SQL 3.pptx
 
Introduction to Database SQL & PL/SQL
Introduction to Database SQL & PL/SQLIntroduction to Database SQL & PL/SQL
Introduction to Database SQL & PL/SQL
 
SQL
SQLSQL
SQL
 
Structured query language
Structured query languageStructured query language
Structured query language
 
Introduction to SQL.pptx
Introduction to SQL.pptxIntroduction to SQL.pptx
Introduction to SQL.pptx
 
SQL Introduction.pptx
SQL Introduction.pptxSQL Introduction.pptx
SQL Introduction.pptx
 
Sql database development part 1
Sql database development part 1Sql database development part 1
Sql database development part 1
 
lovely
lovelylovely
lovely
 
Sq lite module5
Sq lite module5Sq lite module5
Sq lite module5
 
MySQL intro
MySQL introMySQL intro
MySQL intro
 
MySQL intro
MySQL introMySQL intro
MySQL intro
 
SQL overview and software
SQL overview and softwareSQL overview and software
SQL overview and software
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
 
Database Fundamental
Database FundamentalDatabase Fundamental
Database Fundamental
 
DBMS Part-3.pptx
DBMS Part-3.pptxDBMS Part-3.pptx
DBMS Part-3.pptx
 
Lab
LabLab
Lab
 

More from Ehsan Hamzei

Database Normalization
Database NormalizationDatabase Normalization
Database NormalizationEhsan Hamzei
 
Introduction to Oracle Spatial
Introduction to Oracle SpatialIntroduction to Oracle Spatial
Introduction to Oracle SpatialEhsan Hamzei
 
Introduction to oracle DB data structure and data access (persian)
Introduction to oracle DB data structure and data access (persian)Introduction to oracle DB data structure and data access (persian)
Introduction to oracle DB data structure and data access (persian)Ehsan Hamzei
 
Arc GIS Overlay Functions
Arc GIS Overlay FunctionsArc GIS Overlay Functions
Arc GIS Overlay FunctionsEhsan Hamzei
 
Air pollution Assessment (GIS,RS Approach)
Air pollution Assessment (GIS,RS Approach)Air pollution Assessment (GIS,RS Approach)
Air pollution Assessment (GIS,RS Approach)Ehsan Hamzei
 
Bluetooth Positioning
Bluetooth PositioningBluetooth Positioning
Bluetooth PositioningEhsan Hamzei
 
Oracle Data Integrator (persian)
Oracle Data Integrator (persian)Oracle Data Integrator (persian)
Oracle Data Integrator (persian)Ehsan Hamzei
 
Introduction to oracle
Introduction to oracleIntroduction to oracle
Introduction to oracleEhsan Hamzei
 
Spatial queries entity recognition and disambiguation
Spatial queries entity recognition and disambiguationSpatial queries entity recognition and disambiguation
Spatial queries entity recognition and disambiguationEhsan Hamzei
 
Uncertainty in Geospatial Data
Uncertainty in Geospatial DataUncertainty in Geospatial Data
Uncertainty in Geospatial DataEhsan Hamzei
 
Spatial Autocorrelation
Spatial AutocorrelationSpatial Autocorrelation
Spatial AutocorrelationEhsan Hamzei
 
Spatial Transformation
Spatial TransformationSpatial Transformation
Spatial TransformationEhsan Hamzei
 
Introduction to GIS
Introduction to GISIntroduction to GIS
Introduction to GISEhsan Hamzei
 
DTM Quality Assessment
DTM Quality AssessmentDTM Quality Assessment
DTM Quality AssessmentEhsan Hamzei
 

More from Ehsan Hamzei (19)

Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
Introduction to Oracle Spatial
Introduction to Oracle SpatialIntroduction to Oracle Spatial
Introduction to Oracle Spatial
 
Introduction to oracle DB data structure and data access (persian)
Introduction to oracle DB data structure and data access (persian)Introduction to oracle DB data structure and data access (persian)
Introduction to oracle DB data structure and data access (persian)
 
Arc GIS Overlay Functions
Arc GIS Overlay FunctionsArc GIS Overlay Functions
Arc GIS Overlay Functions
 
Air pollution Assessment (GIS,RS Approach)
Air pollution Assessment (GIS,RS Approach)Air pollution Assessment (GIS,RS Approach)
Air pollution Assessment (GIS,RS Approach)
 
Bluetooth Positioning
Bluetooth PositioningBluetooth Positioning
Bluetooth Positioning
 
Oracle Data Integrator (persian)
Oracle Data Integrator (persian)Oracle Data Integrator (persian)
Oracle Data Integrator (persian)
 
Introduction to oracle
Introduction to oracleIntroduction to oracle
Introduction to oracle
 
Spatial queries entity recognition and disambiguation
Spatial queries entity recognition and disambiguationSpatial queries entity recognition and disambiguation
Spatial queries entity recognition and disambiguation
 
Uncertainty in Geospatial Data
Uncertainty in Geospatial DataUncertainty in Geospatial Data
Uncertainty in Geospatial Data
 
Geoprocessing
GeoprocessingGeoprocessing
Geoprocessing
 
Spatial Autocorrelation
Spatial AutocorrelationSpatial Autocorrelation
Spatial Autocorrelation
 
Map algebra
Map algebraMap algebra
Map algebra
 
Fractal Theory
Fractal TheoryFractal Theory
Fractal Theory
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
 
Fuzzy Set
Fuzzy SetFuzzy Set
Fuzzy Set
 
Spatial Transformation
Spatial TransformationSpatial Transformation
Spatial Transformation
 
Introduction to GIS
Introduction to GISIntroduction to GIS
Introduction to GIS
 
DTM Quality Assessment
DTM Quality AssessmentDTM Quality Assessment
DTM Quality Assessment
 

Recently uploaded

Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEselvakumar948
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...drmkjayanthikannan
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxMuhammadAsimMuhammad6
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdfKamal Acharya
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 

Recently uploaded (20)

Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 

Introduction to SQL

  • 1. Introduction to SQL UNIVERSITY OF TEHRAN NOVEMBER, 2016
  • 2. What is SQL?  Structured Query Language  SQL is Structured Query Language, which is a computer language for storing, manipulating and retrieving data stored in relational database.  SQL is the standard language for Relation Database System. All relational database management systems like “MySQL, MS Access, Oracle, Sybase, Informix, postgres and SQL Server” use SQL as standard database language.
  • 3. SQL Commands  DDL - Data Definition Language  DML - Data Manipulation Language  DCL - Data Control Language  DQL - Data Query Language
  • 6. SQL RDBMS Concepts  TABLE  RECORD  COLUMN  CELL  NULL?
  • 7. SQL RDBMS Concepts  SQL Constraints: (applied on columns)  NOT NULL Constraint  UNIQUE Constraint  PRIMARY Key  FOREIGN Key  CHECK Constraint  Data Integrity:  Entity Integrity: There are no duplicate rows in a table  Domain Integrity: Enforces valid entries for a given column by restricting the type  Referential Integrity: Rows cannot be deleted which are used by other records  User-Defined Integrity: Enforces some specific business rules
  • 8. SQL RDBMS Concepts  Data Types:  Character datatypes:  CHAR  NCHAR  NVARCHAR2  VARCHAR2  Numeric datatypes:  NUMBER  BINARY_FLOAT  BINARY_DOUBLE  Date time datatype:  DATE
  • 9. DCL: CREATE USER  1) Define User with Username/Password  2) Grants Sufficient Privileges.  Using SQL Developer (UI, Command)  Using SQL *PLUS (Command)
  • 10. SQL : DDL  Create Table:  COLUMNS  CONSTRAINTS
  • 11. SQL: DDL  DROP TABLE:  ALTER TABLE  OTHER DDL COMMANDS!!!!
  • 12. SQL: DML: INSERT  INSERT INTO:  NUMBER, CHAR/VARCHAR2, DATE?
  • 13. SQL: DML: INSERT  INSERT INTO:  SPECIFIC COLUMNS
  • 14. SQL: DML: INSERT  INSERT INTO:  FOREIGN KEY  ALL DML COMMANDS NEED COMMIT
  • 15. SQL: DML: UPDATE  UPDATE  WHERE CLAUSE
  • 16. SQL: DML: DELETE  DELETE (DELETE VS DROP????)
  • 18. SQL: DQL: SELECT  SELECT  *  SPECIFIC COLUMNS
  • 19. SQL: DQL: SELECT  DISTINCT CLUASE
  • 20. SQL: DQL: SELECT  WHERE CLUASE
  • 21. SQL: DQL: SELECT  IN CLUASE  NOT IN  NULL IN WHERE?  IS NULL  IS NOT NULL
  • 23. SQL: DQL: SELECT  GROUP BY  AGGREGATE FUCTION  MAX,MIN  AVG  COUNT  SUM  …  HAVING CLAUSE
  • 24. SQL: DQL: SELECT  SELECT FROM MULTIPLE TABLES  CARTESIAN MULTIPICATION  JOIN
  • 25. About Me  Ehsan Hamzei  Graduate Student of Geospatial Information System  University of Tehran  Git-Hub: https://github.com/ehsan-hamzei/  Source-Codes: https://github.com/ehsan- hamzei/Oracle-SQL/

Editor's Notes

  1. کارمندانی که حرف o در اسمشون هست و در سال 2003 به بعد استخدام شده اند. SELECT * FROM EMPLOYEES WHERE FIRST_NAME LIKE '%o%' AND HIRE_DATE >= TO_DATE('01-JAN-2003');