SlideShare a Scribd company logo
1 of 10
Structured Query Language
Path from Unorganized to Organized….
Arun Kumar T
What is a Database…
A database is an organized collection of data. The database management
system(DBMS) is the system which acts as medium to carry data from database
and user.
There are 4 types of DBMS
© wideskills.com
Hierarchical
DBMS
Network DBMS
Relational DBMS
Object Oriented
DBMS
What is SQL…
SQL is the standard used to manage data in relational tables. Structured Query
Language normally referred as SQL and pronounced as SEE QU EL..
SQL allows users to create databases, add data, modify and maintain data. It is
governed by standards maintained by ISO(International Standards
Organization).
Example of a relational table:
Employee Department
© wideskills.com
Emp Id Emp
Name
Age Dept_id
1 John 40 1
2 Linda 35 1
3 Max 30 2
Dept_id Dept_name
1 Accounts
2 Production
SQL syntax and query
SQL is case in-sensitive, that is keyword SELECT and select is same for SQL. Every
SQL command should end with a semi-colon (;).
If the syntax is not proper, then executing the command would result in syntax
error.
Command used to fetch data from table is called as query. A basic SQL query
consists of SELECT, FROM and WHERE clause.
SQL SELECT Command example:
SELECT col1, col2, col3,…..
FROM table_name
WHERE condition;
© wideskills.com
Datatypes in SQL
Data type is the attribute of the data expected in the column. Depending upon
the SQL implementation (version) different data types are available. Whenever
you create a column using the data type, the SQL Implementation program would
allocate appropriate amount of space to store the data.
Data types are broadly categorized into Numerics, Strings, Binary, Datetime,
Collection and XML. Most commonly used data types are Integer, Decimal, Float,
Character, Varchar, Boolean, Date.
Example:
1. Boolean Value : Return value = “True”
2. INT : 5400, -2500
3. Numeric or Decimal: Decimal(4,2) = 1000.24
© wideskills.com
Operators and expressions in SQL
In SQL, operators are used in an SQL statement’s WHERE clause to perform
different operations like comparison, logical and arithmetic operations.
Operators that can be used are logical, comparison and Arithmetic. The
Operators include <,>,<>,AND,OR,BETWEEN,ISNULL,+,-,?,% etc.
Generally in any programming language, expression is a combination of values,
constants, variables, operators and functions that results in a value. In SQL,
expressions are used to query database/table to get specific data.
Syntax:
SELECT cols|expressions FROM table_name
WHERE condition(using operators|expressions);
© wideskills.com
DDL
CREATE
ALTER
DROP
CREATE INDEX
DROP INDEX
DML
SELECT
INSERT INTO
UPDATE
DELETE
DCL
GRANT
REVOKE
SQL commands can be used to create databases, edit data in tables, delete data and
maintain data in tables.
SQL commands are classified into 3 groups: DDL(Data definition Language),
DML(Data Manipulation Language) and DCL(Data Control Language).
Let us start with CREATE…
© wideskills.com
Create Database and Table
As part of the Data Definition Language (DDL) under SQL, CREATE keyword is used to
create databases and tables.
One would need to first create Database and then under that database create the required
tables.
Syntax for creation of database:
CREATE DATABASE database_name;
The SQL CREATE TABLE statement allows you to create and define tables in a database.
Syntax for creation of table:
CREATE TABLE tablename
( column1 datatype NULL/NOT NULL,
Column2 datatype NULL/NOT NULL
…………………
…………………
PRIMARY KEY (column name or names),
FOREIGN KEY(column name) REFERENCES Tablename(column name)
);
WE will learn about Primary and Foreign key in the constraints slide…
Optional
© wideskills.com
Create Database and Table-1
Example
Create employee table, which has a constraint on Department id of Departments
table(i.e. value of department id in employee table depends on the value of
Department id in Departments table).
CREATE TABLE employee(
Emp_ID INT NOT NULL,
Emp_Name Varchar(20) NOT NULL,
AGE INT NOT NULL,
Phone_Num INT,
Dept_ID INT NOT NULL,
PRIMARY KEY(Emp_ID),
FOREIGN KEY(DEPT_ID) REFERENCES DEPARTMENTS(DEPT_ID));
© wideskills.com
Interesting, right?
Arun T

More Related Content

Similar to sql ppt.pptx (20)

Sql ppt
Sql pptSql ppt
Sql ppt
 
Module02
Module02Module02
Module02
 
chapter-14-sql-commands.pdf
chapter-14-sql-commands.pdfchapter-14-sql-commands.pdf
chapter-14-sql-commands.pdf
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
Lecture on DBMS & MySQL.pdf v. C. .
Lecture on DBMS & MySQL.pdf v.  C.     .Lecture on DBMS & MySQL.pdf v.  C.     .
Lecture on DBMS & MySQL.pdf v. C. .
 
Structured Query Language (SQL)
Structured Query Language (SQL)Structured Query Language (SQL)
Structured Query Language (SQL)
 
Data base
Data baseData base
Data base
 
Structured query language
Structured query languageStructured query language
Structured query language
 
Introduction to Database SQL & PL/SQL
Introduction to Database SQL & PL/SQLIntroduction to Database SQL & PL/SQL
Introduction to Database SQL & PL/SQL
 
SQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdfSQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdf
 
sql-commands.pdf
sql-commands.pdfsql-commands.pdf
sql-commands.pdf
 
Sql commands
Sql commandsSql commands
Sql commands
 
Sql commands
Sql commandsSql commands
Sql commands
 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
 
PT- Oracle session01
PT- Oracle session01 PT- Oracle session01
PT- Oracle session01
 
SQL EXCLUSIVE NOTES .pdf
SQL EXCLUSIVE NOTES .pdfSQL EXCLUSIVE NOTES .pdf
SQL EXCLUSIVE NOTES .pdf
 
Bank mangement system
Bank mangement systemBank mangement system
Bank mangement system
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptx
 
Viva voce
Viva voceViva voce
Viva voce
 
Structured Query Language
Structured Query LanguageStructured Query Language
Structured Query Language
 

Recently uploaded

HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 

Recently uploaded (20)

HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 

sql ppt.pptx

  • 1. Structured Query Language Path from Unorganized to Organized…. Arun Kumar T
  • 2. What is a Database… A database is an organized collection of data. The database management system(DBMS) is the system which acts as medium to carry data from database and user. There are 4 types of DBMS © wideskills.com Hierarchical DBMS Network DBMS Relational DBMS Object Oriented DBMS
  • 3. What is SQL… SQL is the standard used to manage data in relational tables. Structured Query Language normally referred as SQL and pronounced as SEE QU EL.. SQL allows users to create databases, add data, modify and maintain data. It is governed by standards maintained by ISO(International Standards Organization). Example of a relational table: Employee Department © wideskills.com Emp Id Emp Name Age Dept_id 1 John 40 1 2 Linda 35 1 3 Max 30 2 Dept_id Dept_name 1 Accounts 2 Production
  • 4. SQL syntax and query SQL is case in-sensitive, that is keyword SELECT and select is same for SQL. Every SQL command should end with a semi-colon (;). If the syntax is not proper, then executing the command would result in syntax error. Command used to fetch data from table is called as query. A basic SQL query consists of SELECT, FROM and WHERE clause. SQL SELECT Command example: SELECT col1, col2, col3,….. FROM table_name WHERE condition; © wideskills.com
  • 5. Datatypes in SQL Data type is the attribute of the data expected in the column. Depending upon the SQL implementation (version) different data types are available. Whenever you create a column using the data type, the SQL Implementation program would allocate appropriate amount of space to store the data. Data types are broadly categorized into Numerics, Strings, Binary, Datetime, Collection and XML. Most commonly used data types are Integer, Decimal, Float, Character, Varchar, Boolean, Date. Example: 1. Boolean Value : Return value = “True” 2. INT : 5400, -2500 3. Numeric or Decimal: Decimal(4,2) = 1000.24 © wideskills.com
  • 6. Operators and expressions in SQL In SQL, operators are used in an SQL statement’s WHERE clause to perform different operations like comparison, logical and arithmetic operations. Operators that can be used are logical, comparison and Arithmetic. The Operators include <,>,<>,AND,OR,BETWEEN,ISNULL,+,-,?,% etc. Generally in any programming language, expression is a combination of values, constants, variables, operators and functions that results in a value. In SQL, expressions are used to query database/table to get specific data. Syntax: SELECT cols|expressions FROM table_name WHERE condition(using operators|expressions); © wideskills.com
  • 7. DDL CREATE ALTER DROP CREATE INDEX DROP INDEX DML SELECT INSERT INTO UPDATE DELETE DCL GRANT REVOKE SQL commands can be used to create databases, edit data in tables, delete data and maintain data in tables. SQL commands are classified into 3 groups: DDL(Data definition Language), DML(Data Manipulation Language) and DCL(Data Control Language). Let us start with CREATE… © wideskills.com
  • 8. Create Database and Table As part of the Data Definition Language (DDL) under SQL, CREATE keyword is used to create databases and tables. One would need to first create Database and then under that database create the required tables. Syntax for creation of database: CREATE DATABASE database_name; The SQL CREATE TABLE statement allows you to create and define tables in a database. Syntax for creation of table: CREATE TABLE tablename ( column1 datatype NULL/NOT NULL, Column2 datatype NULL/NOT NULL ………………… ………………… PRIMARY KEY (column name or names), FOREIGN KEY(column name) REFERENCES Tablename(column name) ); WE will learn about Primary and Foreign key in the constraints slide… Optional © wideskills.com
  • 9. Create Database and Table-1 Example Create employee table, which has a constraint on Department id of Departments table(i.e. value of department id in employee table depends on the value of Department id in Departments table). CREATE TABLE employee( Emp_ID INT NOT NULL, Emp_Name Varchar(20) NOT NULL, AGE INT NOT NULL, Phone_Num INT, Dept_ID INT NOT NULL, PRIMARY KEY(Emp_ID), FOREIGN KEY(DEPT_ID) REFERENCES DEPARTMENTS(DEPT_ID)); © wideskills.com