SlideShare a Scribd company logo
Structured Query Language
Prof. K ADISESHA (Ph. D)
Introduction
Architecture of SQL
SQL Commands
SQL Data types
Data Warehouse
2Structured Query Language
Prof. K. Adisesha
Structured Query Language
Prof. K. Adisesha (Ph. D)
3
Structured Query Language (SQL):
SQL is Structured Query Language, which is a computer language for
storing, manipulating and retrieving data stored in relational database.
 Structured Query Language and it helps to make practice on SQL commands which
provides immediate results.
 SQL is the standard language for Relation Database System.
 All relational database management systems like MySQL, MS Access, and Oracle,
Sybase, Informix, and SQL Server use SQL as standard database language.
Structured Query Language
Prof. K. Adisesha (Ph. D)
4
A Brief History of SQL:
A Relational database management system (RDBMS) is a database management
system (DBMS) that is based on the relational model as introduced by E. F. Codd.
 1970 − Dr. Edgar F. "Ted" Codd of IBM is known as the father of relational
databases. He described a relational model for databases.
 1974 − Structured Query Language appeared.
 1978 − IBM worked to develop Codd's ideas and released a product named System/R.
 1986 − IBM developed the first prototype of relational database and standardized by
ANSI. The first relational database was released by Relational Software which later
came to be known as Oracle.
Structured Query Language
Prof. K. Adisesha (Ph. D)
5
Structured Query Language (SQL):
SQL is Structured Query Language, which is a computer language for
storing, manipulating and retrieving data stored in relational database.
Structured Query Language
Prof. K. Adisesha (Ph. D)
6
Structured Query Language (SQL):
When you are executing an SQL command for any RDBMS, the system determines the
best way to carry out your request and SQL engine figures out how to interpret the task.
 There are various components included in the process.
 These components are:
 Query Dispatcher
 Optimization Engines
 Classic Query Engine
 SQL Query Engine
Structured Query Language
Prof. K. Adisesha (Ph. D)
7
Need for SQL:
SQL is Structured Query Language used for storing, manipulating and
retrieving data stored in relational database.
 Allows users to create and drop databases and tables.
 Allows users to describe the data.
 Allows users to define the data in database and manipulate that data.
 Allows users to access data in relational database management systems.
 Allows embedding within other languages using SQL modules, libraries & pre-
compilers.
 Allows users to set permissions on tables, procedures, and views
Structured Query Language
Prof. K. Adisesha (Ph. D)
8
SQL Commands:
The standard SQL commands to interact with relational databases are CREATE,
SELECT, INSERT, UPDATE, DELETE and DROP.
 These commands can be classified into groups based on their nature:
 DDL - Data Definition Language
 DML - Data Manipulation Language
 DCL - Data Control Language
 TCL – Transaction Control Language
Structured Query Language
Prof. K. Adisesha (Ph. D)
9
Data Definition Language (DDL):
DDL defines the conceptual schema providing a link between the logical and the
physical structure of the database.
 The functions of the Data Definition Language (DDL) are:
 It defines the physical characteristics of each record, filed in the record, field’s data type,
field's length, field’s logical name and also specify relationship among those records.
 Describes the schema and subschema.
 Indicates the keys of records.
 Provides data security measures.
 Provides for the logical and physical data independence.
Structured Query Language
Prof. K. Adisesha (Ph. D)
10
Data Definition Language (DDL):
DDL defines the conceptual schema providing a link between the logical and
the physical structure of the database.
 Few of the basic commands for DDL are:
Command Description
CREATE
Creates a new table, a view of a table, or other object in the
database.
ALTER Modifies an existing database object, such as a table
DROP
Deletes an entire table, a view of a table or other objects in the
database.
RENAME Renames an existing database object, such as a table
Structured Query Language
Prof. K. Adisesha (Ph. D)
11
Data Manipulation Language(DML):
DML provides the data manipulation techniques like selection, insertion,
deletion, updation, modification, replacement, retrieval, sorting and display of
data or records.
 DML facilitates use of relationship between the records.
 DML provides for independence of programming languages by supporting
several high-level programming languages like COBOL, PL/1 and C++.:
Structured Query Language
Prof. K. Adisesha (Ph. D)
12
Data Manipulation Language(DML):
DML provides the data manipulation techniques like selection, insertion,
deletion, updation, modification, replacement, retrieval, sorting and display of
data or records.
 Few of the basic commands for DML are:
Command Description
INSERT Creates a record.
UPDATE Modifies records.
DELETE Deletes records.
Structured Query Language
Prof. K. Adisesha (Ph. D)
13
Data Control Language (DCL):
These SQL commands are used for providing security to database objects.
 Few of the basic commands for DCL are:
Command Description
GRANT
Gives a privilege to user.
Such as setting Passwords to Database Users
REVOKE Takes back privileges granted from user.
Structured Query Language
Prof. K. Adisesha (Ph. D)
14
Transaction Control Language (TCL):
It includes commands to control the transactions in a database system.
 Few of the basic commands for TCL are:
Command Description
SELECT Retrieves certain records from one or more tables
syntax:
>SELECT * FROM table_name;
Data Types in SQL
Prof. K. Adisesha (Ph. D)
15
Data Types in SQL:
 The following are the most common data types of SQL
Data Data Type From To
Numeric
int -2,147,483,648 2,147,483,647
numeric -10^38 +1 10^38 -1
float -1.79E + 308 1.79E + 308
real -3.40E + 38 3.40E + 38
String
Char
Maximum length of 8,000
characters
Fixed length non-Unicode characters
varchar Maximum of 8,000 characters. Variable-length non-Unicode data
Data Types in SQL
Prof. K. Adisesha (Ph. D)
16
Data Types in SQL:
 The following are the most common data types of SQL
Data Data Type From To
Date/
Time
datetime Jan 1, 1753 Dec 31, 9999
smalldatetime Jan 1, 1900 Jun 6, 2079
date Stores a date like June 30, 2020
time Stores a time of day like 12:30 P.M.
timestamp
Stores a database-wide unique number that gets updated every
time a row gets updated
Operator in SQL
Prof. K. Adisesha (Ph. D)
17
Operator in SQL:
An operator is a reserved word or a character used primarily in an SQL
statement's WHERE clause to perform operation(s), such as comparisons and
arithmetic operations.
 These Operators are used to specify conditions in an SQL statement and to
serve as conjunctions for multiple conditions in a statement.
 Arithmetic operators
 Comparison operators
 Logical operators
 Operators used to negate conditions
Arithmetic Operators
Prof. K. Adisesha (Ph. D)
18
Arithmetic Operators in SQL:
 The following are the most common Arithmetic Operators of SQL: Given a=10, b=20
Operator Description Example
(Addition) + Adds values on either side of the operator a + b will give 30
(Subtraction) - Subtracts right hand operand from left hand operand. a - b will give -10
(Multiplication) * Multiplies values on either side of the operator. a * b will give 200
(Division) / Divides left hand operand by right hand operand. b / a will give 2
(Modulus) %
Divides left hand operand by right hand operand and
returns remainder.
b % a will give 0
Operator Description Example
=
Checks if the values of two operands are equal or not, if yes then
condition becomes true.
(a = b) is False
!= , < >
Checks if the values of two operands are equal or not, if values are
not equal then condition becomes true..
(a != b) is true
(a <> b) is true
>, >=
Checks if the value of left operand is greater than the value of right
operand, if yes then condition becomes true.
(a > b) is False
(a >= b) is False
< , <=
Checks if the value of left operand is less than or equal to the value of
right operand, if yes then condition becomes true.
(a < b) is true
(a <= b) is true
! > , !<
Checks if the value of left operand is not less than the value of right
operand, if yes then condition becomes true.
(a !< b) is false
(a !> b) is true
Comparison Operators
Prof. K. Adisesha (Ph. D)
19
Comparison Operators in SQL:
 The following are the most common Comparison Operators of SQL: Given a=10, b=20
Logical Operators
Prof. K. Adisesha (Ph. D)
20
Logical Operators in SQL:
 The following are the most common Logical Operators of SQL:
Operator Description
ALL, ANY
The ALL operator is used to compare a value to all values in another value set.
The ANY operator is used to compare a value to any applicable value in the list on condition
AND, OR The AND, OR operator allows the existence of multiple conditions in an SQL statement's
NOT The NOT operator reverses the meaning of the logical operator with which it is used
BETWEEN
The BETWEEN operator is used to search for values that are within a set of values, given the
minimum value and the maximum value.
EXISTS
The EXISTS operator is used to search for the presence of a row in a specified table that meets a
certain criterion.
UNIQUE he UNIQUE operator searches every row of a specified table for uniqueness
SQL - Expressions
Prof. K. Adisesha (Ph. D)
21
Expressions in SQL:
An expression is a combination of one or more values, operators and SQL
functions that evaluate to a value..
 These SQL EXPRESSIONs are like formulae and they are written in query
language.
 There are different types of SQL expressions are:
 Boolean
 Numeric
 Date
SQL - Expressions
Prof. K. Adisesha (Ph. D)
22
Boolean Expressions in SQL:
SQL Boolean Expressions fetch the data based on matching a single value.
 Following is the syntax:
SELECT column1, column2, .. columnN
FROM table_name
WHERE SINGLE VALUE MATCHING EXPRESSION;
 Example showing the usage of various SQL Boolean Expressions −
SQL> SELECT * FROM CUSTOMERS WHERE SALARY = 20000;
SQL - Expressions
Prof. K. Adisesha (Ph. D)
23
Numeric Expression in SQL:
These expressions are used to perform any mathematical operation in any query.
 The numerical expression is used for a mathematical expression or any formula
 Following is the syntax:
SELECT numerical expression as OPERATION_NAME
[FROM table_name
WHERE CONDITION] ;
 Example showing the usage of various SQL Numeric Expressions −
SQL> SELECT (15 + 6) AS ADDITION;
SQL> SELECT COUNT(*) AS "RECORDS" FROM CUSTOMERS;
SQL - Expressions
Prof. K. Adisesha (Ph. D)
24
Date Expressions in SQL:
These expressions are used to calculate and return the Date and Time operation in any
query.
 Date Expressions return current system date and time values
 Following is the syntax:
SQL> SELECT CURRENT_TIMESTAMP;
 Example showing the usage of various SQL Numeric Expressions −
SQL> SELECT GETDATE();
SQL - Database
Prof. K. Adisesha (Ph. D)
25
Managing Database in SQL:
Always the database name should be unique within the RDBMS
CREATE Database:
 The SQL CREATE DATABASE statement is used to create a new SQL database
 Syntax: CREATE DATABASE DatabaseName;
DROP or DELETE Database
 The SQL DROP DATABASE statement is used to drop an existing database in SQL schema
 Syntax: DROP DATABASE DatabaseName;
SELECT Database, USE Statement
 The SQL USE statement is used to select any existing database in the SQL schema
 Syntax: USE DatabaseName;
SQL - CREATE Table
Prof. K. Adisesha (Ph. D)
26
SQL CREATE TABLE Statement:
Creating a basic table involves naming the table and defining its columns and each
column's data type.
 The SQL CREATE TABLE statement is used to create a new table
 Syntax: Example:
SQL - Drop Table
Prof. K. Adisesha (Ph. D)
27
SQL Drop TABLE Statement:
The SQL DROP TABLE statement is used to remove a table definition and all the data,
indexes, triggers, constraints and permission specifications for that table..
 The DROP TABLE statement is used to drop an existing table in a database
 Deleting a table will result in loss of complete information stored in the table!
 Syntax: Example:
SQL TRUNCATE TABLE
 The TRUNCATE TABLE statement is used to delete the data inside a table, but not the table
itself.
 Syntax:
SQL - Alter Table
Prof. K. Adisesha (Ph. D)
28
SQL Alter TABLE Statement:
The ALTER TABLE statement is used to add, delete, or modify columns in an existing
table.
ALTER TABLE - ADD Column
 To add a column in a table, use the following syntax:
ALTER TABLE - DROP Column
 To drop a column in a table, use the following syntax:
ALTER TABLE - ALTER/MODIFY Column
 To drop a column in a table, use the following syntax:
SQL Constraints
Prof. K. Adisesha (Ph. D)
29
SQL Create Constraints:
Constraints can be specified when the table is created with the CREATE TABLE
statement, or after the table is created with the ALTER TABLE statement.
 SQL constraints are used to specify rules for the data in a table
 The following constraints are commonly used in SQL:
 NOT NULL - Ensures that a column cannot have a NULL value
 UNIQUE - Ensures that all values in a column are different
 PRIMARY KEY - A combination of a NOT NULL and UNIQUE.
 FOREIGN KEY - Uniquely identifies a row/record in another table
 CHECK - Ensures that all values in a column satisfies a specific condition
 DEFAULT - Sets a default value for a column when no value is specified
SQL Constraints
Prof. K. Adisesha (Ph. D)
30
SQL Create Constraints:
Constraints can be specified when the table is created with the CREATE TABLE
statement, or after the table is created with the ALTER TABLE statement.
 SQL constraints are used to specify rules for the data in a table
 Constraints can be column level or table level.
 Syntax: Example:
SQL INSERT Statement
Prof. K. Adisesha (Ph. D)
31
SQL INSERT INTO Statement:
The INSERT INTO statement is used to insert new records in a table.
 It is possible to write the INSERT INTO statement in two ways.
 The first way specifies both the column names and the values to be inserted
 Syntax:
 If you are adding values for all the columns of the table, you do not need to specify the column
names in the SQL query.
 Syntax:
SQL SELECT Statement
Prof. K. Adisesha (Ph. D)
32
SQL SELECT Statement:
The SELECT statement is used to select data from a database.
 The data returned is stored in a result table, called the result-set.
 If you want to select all the fields available in the table, use the following syntax:
 The SELECT DISTINCT statement is used to return only distinct (different) values..
 Syntax:
 The WHERE clause is used to extract only those records that fulfill a specified condition.
 Syntax:
SQL Joins
Prof. K. Adisesha (Ph. D)
33
SQL JOIN:
A JOIN clause is used to combine rows from two or more tables, based on a related
column between them.
 Different types of the JOINs in SQL:
 (INNER) JOIN: Returns records that have matching values in both tables
 LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records
from the right table
 RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched
records from the left table
 FULL (OUTER) JOIN: Returns all records when there is a match in either left or right
table
SQL Joins
Prof. K. Adisesha (Ph. D)
34
SQL INNER JOIN:
The INNER JOIN keyword selects records that have matching values in both tables.
 (INNER) JOIN: Returns records that have matching values in both tables
SQL Joins
Prof. K. Adisesha (Ph. D)
35
SQL LEFT (OUTER) JOIN:
The LEFT JOIN keyword returns all records from the left table (table1), and the
matched records from the right table (table2).
 The result is NULL from the right side, if there is no match.
 LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from
the right table
SQL Joins
Prof. K. Adisesha (Ph. D)
36
SQL RIGHT JOIN:
The RIGHT JOIN keyword returns all records from the right table (table2), and the
matched records from the left table (table1).
 The result is NULL from the left side, when there is no match.
 RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records
from the left table
SQL Joins
Prof. K. Adisesha (Ph. D)
37
SQL FULL OUTER JOIN:
The FULL OUTER JOIN keyword returns all records when there is a match in left
(table1) or right (table2) table records.
 FULL OUTER JOIN can potentially return very large result-sets.
 FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table
SQL ORDER BY
Prof. K. Adisesha (Ph. D)
38
SQL ORDER BY Keyword:
The ORDER BY keyword is used to sort the result-set in ascending or descending
order.
 The ORDER BY keyword sorts the records in ascending order by default. To sort the
records in descending order, use the DESC keyword.
SQL GROUP BY
Prof. K. Adisesha (Ph. D)
39
SQL GROUP BY:
he GROUP BY statement groups rows that have the same values into summary rows,
like "find the number of customers in each country".
 The GROUP BY statement is often used with aggregate functions (COUNT, MAX,
MIN, SUM, AVG) to group the result-set by one or more columns.
SQL Functions
Prof. K. Adisesha (Ph. D)
40
SQL MIN() and MAX() Functions:
The MIN() function returns the smallest value of the selected column.
 MIN() Syntax:
The MAX() function returns the largest value of the selected column.
 MAX() Syntax:
SQL Functions
Prof. K. Adisesha (Ph. D)
41
SQL COUNT(), AVG() and SUM() Functions:
 The COUNT() function returns the number of rows that matches a specified
criterion.
 The AVG() function returns the average value of a numeric column.
 The SUM() function returns the total sum of a numeric column.
Discussion
Prof. K. Adisesha (Ph. D)
42
Queries ?
Prof. K. Adisesha
Ad

More Related Content

What's hot (20)

Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)
Punjab University
 
SQL
SQLSQL
SQL
Vineeta Garg
 
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
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
Eddyzulham Mahluzydde
 
Introduction to structured query language (sql)
Introduction to structured query language (sql)Introduction to structured query language (sql)
Introduction to structured query language (sql)
Sabana Maharjan
 
SQL.ppt
SQL.pptSQL.ppt
SQL.ppt
Ranjit273515
 
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
 
Sql commands
Sql commandsSql commands
Sql commands
Pooja Dixit
 
Mysql
MysqlMysql
Mysql
TSUBHASHRI
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
Stewart Rogers
 
8. sql
8. sql8. sql
8. sql
khoahuy82
 
Sql ppt
Sql pptSql ppt
Sql ppt
Anuja Lad
 
Introduction to sql
Introduction to sqlIntroduction to sql
Introduction to sql
VARSHAKUMARI49
 
SQL Queries
SQL QueriesSQL Queries
SQL Queries
Nilt1234
 
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 basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
Mohd Tousif
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
Sql subquery
Sql  subquerySql  subquery
Sql subquery
Raveena Thakur
 
Basic SQL and History
 Basic SQL and History Basic SQL and History
Basic SQL and History
SomeshwarMoholkar
 
Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)
Punjab University
 
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
 
Introduction to structured query language (sql)
Introduction to structured query language (sql)Introduction to structured query language (sql)
Introduction to structured query language (sql)
Sabana Maharjan
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
Shrija Madhu
 
SQL Queries
SQL QueriesSQL Queries
SQL Queries
Nilt1234
 
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 basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
Mohd Tousif
 

Similar to Sql ppt (20)

chapter-14-sql-commands.pdf
chapter-14-sql-commands.pdfchapter-14-sql-commands.pdf
chapter-14-sql-commands.pdf
study material
 
The Smartpath Information Systems | BASIC RDBMS CONCEPTS
The Smartpath Information Systems | BASIC RDBMS CONCEPTSThe Smartpath Information Systems | BASIC RDBMS CONCEPTS
The Smartpath Information Systems | BASIC RDBMS CONCEPTS
The Smartpath Information Systems,Bhilai,Durg,Chhattisgarh.
 
Structure query language (sql)
Structure query language (sql)Structure query language (sql)
Structure query language (sql)
Nalina Kumari
 
Structure Query Language (SQL).pptx
Structure Query Language (SQL).pptxStructure Query Language (SQL).pptx
Structure Query Language (SQL).pptx
NalinaKumari2
 
Introduction to the Structured Query Language SQL
Introduction to the Structured Query Language SQLIntroduction to the Structured Query Language SQL
Introduction to the Structured Query Language SQL
Harmony Kwawu
 
sql-commands.pdf
sql-commands.pdfsql-commands.pdf
sql-commands.pdf
Prof. Dr. K. Adisesha
 
Sql commands
Sql commandsSql commands
Sql commands
Prof. Dr. K. Adisesha
 
Sql commands
Sql commandsSql commands
Sql commands
Prof. Dr. K. Adisesha
 
SQL2.pptx
SQL2.pptxSQL2.pptx
SQL2.pptx
RareDeath
 
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. .
MayankSinghRawat6
 
lovely
lovelylovely
lovely
love0323
 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
Danish Mehraj
 
12 SQL
12 SQL12 SQL
12 SQL
Praveen M Jigajinni
 
12 SQL
12 SQL12 SQL
12 SQL
Praveen M Jigajinni
 
DBMS Part-3.pptx
DBMS Part-3.pptxDBMS Part-3.pptx
DBMS Part-3.pptx
Prof. Dr. K. Adisesha
 
Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)
Rakibul Hasan Pranto
 
sql ppt.pptx
sql ppt.pptxsql ppt.pptx
sql ppt.pptx
ArunT58
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
Divyank Jindal
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
Aditya Kumar Tripathy
 
Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013
Prosanta Ghosh
 
Ad

More from Prof. Dr. K. Adisesha (20)

Design and Analysis of Algorithms ppt by K. Adi
Design and Analysis of Algorithms ppt by K. AdiDesign and Analysis of Algorithms ppt by K. Adi
Design and Analysis of Algorithms ppt by K. Adi
Prof. Dr. K. Adisesha
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
 
Operating System-4 "File Management" by Adi.pdf
Operating System-4 "File Management" by Adi.pdfOperating System-4 "File Management" by Adi.pdf
Operating System-4 "File Management" by Adi.pdf
Prof. Dr. K. Adisesha
 
Operating System-3 "Memory Management" by Adi.pdf
Operating System-3 "Memory Management" by Adi.pdfOperating System-3 "Memory Management" by Adi.pdf
Operating System-3 "Memory Management" by Adi.pdf
Prof. Dr. K. Adisesha
 
Operating System Concepts Part-1 by_Adi.pdf
Operating System Concepts Part-1 by_Adi.pdfOperating System Concepts Part-1 by_Adi.pdf
Operating System Concepts Part-1 by_Adi.pdf
Prof. Dr. K. Adisesha
 
Operating System-2_Process Managementby_Adi.pdf
Operating System-2_Process Managementby_Adi.pdfOperating System-2_Process Managementby_Adi.pdf
Operating System-2_Process Managementby_Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfSoftware Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfSoftware Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfSoftware Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfSoftware Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfSoftware Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfSoftware Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Prof. Dr. K. Adisesha
 
Computer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaComputer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. Adisesha
Prof. Dr. K. Adisesha
 
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaCCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
Prof. Dr. K. Adisesha
 
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. AdiseshaCCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
Prof. Dr. K. Adisesha
 
CCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. AdiseshaCCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. Adisesha
Prof. Dr. K. Adisesha
 
CCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdfCCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdf
Prof. Dr. K. Adisesha
 
Introduction to Computers.pdf
Introduction to Computers.pdfIntroduction to Computers.pdf
Introduction to Computers.pdf
Prof. Dr. K. Adisesha
 
R_Programming.pdf
R_Programming.pdfR_Programming.pdf
R_Programming.pdf
Prof. Dr. K. Adisesha
 
Scholarship.pdf
Scholarship.pdfScholarship.pdf
Scholarship.pdf
Prof. Dr. K. Adisesha
 
Design and Analysis of Algorithms ppt by K. Adi
Design and Analysis of Algorithms ppt by K. AdiDesign and Analysis of Algorithms ppt by K. Adi
Design and Analysis of Algorithms ppt by K. Adi
Prof. Dr. K. Adisesha
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
 
Operating System-4 "File Management" by Adi.pdf
Operating System-4 "File Management" by Adi.pdfOperating System-4 "File Management" by Adi.pdf
Operating System-4 "File Management" by Adi.pdf
Prof. Dr. K. Adisesha
 
Operating System-3 "Memory Management" by Adi.pdf
Operating System-3 "Memory Management" by Adi.pdfOperating System-3 "Memory Management" by Adi.pdf
Operating System-3 "Memory Management" by Adi.pdf
Prof. Dr. K. Adisesha
 
Operating System Concepts Part-1 by_Adi.pdf
Operating System Concepts Part-1 by_Adi.pdfOperating System Concepts Part-1 by_Adi.pdf
Operating System Concepts Part-1 by_Adi.pdf
Prof. Dr. K. Adisesha
 
Operating System-2_Process Managementby_Adi.pdf
Operating System-2_Process Managementby_Adi.pdfOperating System-2_Process Managementby_Adi.pdf
Operating System-2_Process Managementby_Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfSoftware Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfSoftware Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfSoftware Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfSoftware Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfSoftware Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfSoftware Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Prof. Dr. K. Adisesha
 
Computer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaComputer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. Adisesha
Prof. Dr. K. Adisesha
 
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaCCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
Prof. Dr. K. Adisesha
 
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. AdiseshaCCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
Prof. Dr. K. Adisesha
 
CCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. AdiseshaCCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. Adisesha
Prof. Dr. K. Adisesha
 
CCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdfCCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdf
Prof. Dr. K. Adisesha
 
Ad

Recently uploaded (20)

Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 

Sql ppt

  • 1. Structured Query Language Prof. K ADISESHA (Ph. D)
  • 2. Introduction Architecture of SQL SQL Commands SQL Data types Data Warehouse 2Structured Query Language Prof. K. Adisesha
  • 3. Structured Query Language Prof. K. Adisesha (Ph. D) 3 Structured Query Language (SQL): SQL is Structured Query Language, which is a computer language for storing, manipulating and retrieving data stored in relational database.  Structured Query Language and it helps to make practice on SQL commands which provides immediate results.  SQL is the standard language for Relation Database System.  All relational database management systems like MySQL, MS Access, and Oracle, Sybase, Informix, and SQL Server use SQL as standard database language.
  • 4. Structured Query Language Prof. K. Adisesha (Ph. D) 4 A Brief History of SQL: A Relational database management system (RDBMS) is a database management system (DBMS) that is based on the relational model as introduced by E. F. Codd.  1970 − Dr. Edgar F. "Ted" Codd of IBM is known as the father of relational databases. He described a relational model for databases.  1974 − Structured Query Language appeared.  1978 − IBM worked to develop Codd's ideas and released a product named System/R.  1986 − IBM developed the first prototype of relational database and standardized by ANSI. The first relational database was released by Relational Software which later came to be known as Oracle.
  • 5. Structured Query Language Prof. K. Adisesha (Ph. D) 5 Structured Query Language (SQL): SQL is Structured Query Language, which is a computer language for storing, manipulating and retrieving data stored in relational database.
  • 6. Structured Query Language Prof. K. Adisesha (Ph. D) 6 Structured Query Language (SQL): When you are executing an SQL command for any RDBMS, the system determines the best way to carry out your request and SQL engine figures out how to interpret the task.  There are various components included in the process.  These components are:  Query Dispatcher  Optimization Engines  Classic Query Engine  SQL Query Engine
  • 7. Structured Query Language Prof. K. Adisesha (Ph. D) 7 Need for SQL: SQL is Structured Query Language used for storing, manipulating and retrieving data stored in relational database.  Allows users to create and drop databases and tables.  Allows users to describe the data.  Allows users to define the data in database and manipulate that data.  Allows users to access data in relational database management systems.  Allows embedding within other languages using SQL modules, libraries & pre- compilers.  Allows users to set permissions on tables, procedures, and views
  • 8. Structured Query Language Prof. K. Adisesha (Ph. D) 8 SQL Commands: The standard SQL commands to interact with relational databases are CREATE, SELECT, INSERT, UPDATE, DELETE and DROP.  These commands can be classified into groups based on their nature:  DDL - Data Definition Language  DML - Data Manipulation Language  DCL - Data Control Language  TCL – Transaction Control Language
  • 9. Structured Query Language Prof. K. Adisesha (Ph. D) 9 Data Definition Language (DDL): DDL defines the conceptual schema providing a link between the logical and the physical structure of the database.  The functions of the Data Definition Language (DDL) are:  It defines the physical characteristics of each record, filed in the record, field’s data type, field's length, field’s logical name and also specify relationship among those records.  Describes the schema and subschema.  Indicates the keys of records.  Provides data security measures.  Provides for the logical and physical data independence.
  • 10. Structured Query Language Prof. K. Adisesha (Ph. D) 10 Data Definition Language (DDL): DDL defines the conceptual schema providing a link between the logical and the physical structure of the database.  Few of the basic commands for DDL are: Command Description CREATE Creates a new table, a view of a table, or other object in the database. ALTER Modifies an existing database object, such as a table DROP Deletes an entire table, a view of a table or other objects in the database. RENAME Renames an existing database object, such as a table
  • 11. Structured Query Language Prof. K. Adisesha (Ph. D) 11 Data Manipulation Language(DML): DML provides the data manipulation techniques like selection, insertion, deletion, updation, modification, replacement, retrieval, sorting and display of data or records.  DML facilitates use of relationship between the records.  DML provides for independence of programming languages by supporting several high-level programming languages like COBOL, PL/1 and C++.:
  • 12. Structured Query Language Prof. K. Adisesha (Ph. D) 12 Data Manipulation Language(DML): DML provides the data manipulation techniques like selection, insertion, deletion, updation, modification, replacement, retrieval, sorting and display of data or records.  Few of the basic commands for DML are: Command Description INSERT Creates a record. UPDATE Modifies records. DELETE Deletes records.
  • 13. Structured Query Language Prof. K. Adisesha (Ph. D) 13 Data Control Language (DCL): These SQL commands are used for providing security to database objects.  Few of the basic commands for DCL are: Command Description GRANT Gives a privilege to user. Such as setting Passwords to Database Users REVOKE Takes back privileges granted from user.
  • 14. Structured Query Language Prof. K. Adisesha (Ph. D) 14 Transaction Control Language (TCL): It includes commands to control the transactions in a database system.  Few of the basic commands for TCL are: Command Description SELECT Retrieves certain records from one or more tables syntax: >SELECT * FROM table_name;
  • 15. Data Types in SQL Prof. K. Adisesha (Ph. D) 15 Data Types in SQL:  The following are the most common data types of SQL Data Data Type From To Numeric int -2,147,483,648 2,147,483,647 numeric -10^38 +1 10^38 -1 float -1.79E + 308 1.79E + 308 real -3.40E + 38 3.40E + 38 String Char Maximum length of 8,000 characters Fixed length non-Unicode characters varchar Maximum of 8,000 characters. Variable-length non-Unicode data
  • 16. Data Types in SQL Prof. K. Adisesha (Ph. D) 16 Data Types in SQL:  The following are the most common data types of SQL Data Data Type From To Date/ Time datetime Jan 1, 1753 Dec 31, 9999 smalldatetime Jan 1, 1900 Jun 6, 2079 date Stores a date like June 30, 2020 time Stores a time of day like 12:30 P.M. timestamp Stores a database-wide unique number that gets updated every time a row gets updated
  • 17. Operator in SQL Prof. K. Adisesha (Ph. D) 17 Operator in SQL: An operator is a reserved word or a character used primarily in an SQL statement's WHERE clause to perform operation(s), such as comparisons and arithmetic operations.  These Operators are used to specify conditions in an SQL statement and to serve as conjunctions for multiple conditions in a statement.  Arithmetic operators  Comparison operators  Logical operators  Operators used to negate conditions
  • 18. Arithmetic Operators Prof. K. Adisesha (Ph. D) 18 Arithmetic Operators in SQL:  The following are the most common Arithmetic Operators of SQL: Given a=10, b=20 Operator Description Example (Addition) + Adds values on either side of the operator a + b will give 30 (Subtraction) - Subtracts right hand operand from left hand operand. a - b will give -10 (Multiplication) * Multiplies values on either side of the operator. a * b will give 200 (Division) / Divides left hand operand by right hand operand. b / a will give 2 (Modulus) % Divides left hand operand by right hand operand and returns remainder. b % a will give 0
  • 19. Operator Description Example = Checks if the values of two operands are equal or not, if yes then condition becomes true. (a = b) is False != , < > Checks if the values of two operands are equal or not, if values are not equal then condition becomes true.. (a != b) is true (a <> b) is true >, >= Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true. (a > b) is False (a >= b) is False < , <= Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true. (a < b) is true (a <= b) is true ! > , !< Checks if the value of left operand is not less than the value of right operand, if yes then condition becomes true. (a !< b) is false (a !> b) is true Comparison Operators Prof. K. Adisesha (Ph. D) 19 Comparison Operators in SQL:  The following are the most common Comparison Operators of SQL: Given a=10, b=20
  • 20. Logical Operators Prof. K. Adisesha (Ph. D) 20 Logical Operators in SQL:  The following are the most common Logical Operators of SQL: Operator Description ALL, ANY The ALL operator is used to compare a value to all values in another value set. The ANY operator is used to compare a value to any applicable value in the list on condition AND, OR The AND, OR operator allows the existence of multiple conditions in an SQL statement's NOT The NOT operator reverses the meaning of the logical operator with which it is used BETWEEN The BETWEEN operator is used to search for values that are within a set of values, given the minimum value and the maximum value. EXISTS The EXISTS operator is used to search for the presence of a row in a specified table that meets a certain criterion. UNIQUE he UNIQUE operator searches every row of a specified table for uniqueness
  • 21. SQL - Expressions Prof. K. Adisesha (Ph. D) 21 Expressions in SQL: An expression is a combination of one or more values, operators and SQL functions that evaluate to a value..  These SQL EXPRESSIONs are like formulae and they are written in query language.  There are different types of SQL expressions are:  Boolean  Numeric  Date
  • 22. SQL - Expressions Prof. K. Adisesha (Ph. D) 22 Boolean Expressions in SQL: SQL Boolean Expressions fetch the data based on matching a single value.  Following is the syntax: SELECT column1, column2, .. columnN FROM table_name WHERE SINGLE VALUE MATCHING EXPRESSION;  Example showing the usage of various SQL Boolean Expressions − SQL> SELECT * FROM CUSTOMERS WHERE SALARY = 20000;
  • 23. SQL - Expressions Prof. K. Adisesha (Ph. D) 23 Numeric Expression in SQL: These expressions are used to perform any mathematical operation in any query.  The numerical expression is used for a mathematical expression or any formula  Following is the syntax: SELECT numerical expression as OPERATION_NAME [FROM table_name WHERE CONDITION] ;  Example showing the usage of various SQL Numeric Expressions − SQL> SELECT (15 + 6) AS ADDITION; SQL> SELECT COUNT(*) AS "RECORDS" FROM CUSTOMERS;
  • 24. SQL - Expressions Prof. K. Adisesha (Ph. D) 24 Date Expressions in SQL: These expressions are used to calculate and return the Date and Time operation in any query.  Date Expressions return current system date and time values  Following is the syntax: SQL> SELECT CURRENT_TIMESTAMP;  Example showing the usage of various SQL Numeric Expressions − SQL> SELECT GETDATE();
  • 25. SQL - Database Prof. K. Adisesha (Ph. D) 25 Managing Database in SQL: Always the database name should be unique within the RDBMS CREATE Database:  The SQL CREATE DATABASE statement is used to create a new SQL database  Syntax: CREATE DATABASE DatabaseName; DROP or DELETE Database  The SQL DROP DATABASE statement is used to drop an existing database in SQL schema  Syntax: DROP DATABASE DatabaseName; SELECT Database, USE Statement  The SQL USE statement is used to select any existing database in the SQL schema  Syntax: USE DatabaseName;
  • 26. SQL - CREATE Table Prof. K. Adisesha (Ph. D) 26 SQL CREATE TABLE Statement: Creating a basic table involves naming the table and defining its columns and each column's data type.  The SQL CREATE TABLE statement is used to create a new table  Syntax: Example:
  • 27. SQL - Drop Table Prof. K. Adisesha (Ph. D) 27 SQL Drop TABLE Statement: The SQL DROP TABLE statement is used to remove a table definition and all the data, indexes, triggers, constraints and permission specifications for that table..  The DROP TABLE statement is used to drop an existing table in a database  Deleting a table will result in loss of complete information stored in the table!  Syntax: Example: SQL TRUNCATE TABLE  The TRUNCATE TABLE statement is used to delete the data inside a table, but not the table itself.  Syntax:
  • 28. SQL - Alter Table Prof. K. Adisesha (Ph. D) 28 SQL Alter TABLE Statement: The ALTER TABLE statement is used to add, delete, or modify columns in an existing table. ALTER TABLE - ADD Column  To add a column in a table, use the following syntax: ALTER TABLE - DROP Column  To drop a column in a table, use the following syntax: ALTER TABLE - ALTER/MODIFY Column  To drop a column in a table, use the following syntax:
  • 29. SQL Constraints Prof. K. Adisesha (Ph. D) 29 SQL Create Constraints: Constraints can be specified when the table is created with the CREATE TABLE statement, or after the table is created with the ALTER TABLE statement.  SQL constraints are used to specify rules for the data in a table  The following constraints are commonly used in SQL:  NOT NULL - Ensures that a column cannot have a NULL value  UNIQUE - Ensures that all values in a column are different  PRIMARY KEY - A combination of a NOT NULL and UNIQUE.  FOREIGN KEY - Uniquely identifies a row/record in another table  CHECK - Ensures that all values in a column satisfies a specific condition  DEFAULT - Sets a default value for a column when no value is specified
  • 30. SQL Constraints Prof. K. Adisesha (Ph. D) 30 SQL Create Constraints: Constraints can be specified when the table is created with the CREATE TABLE statement, or after the table is created with the ALTER TABLE statement.  SQL constraints are used to specify rules for the data in a table  Constraints can be column level or table level.  Syntax: Example:
  • 31. SQL INSERT Statement Prof. K. Adisesha (Ph. D) 31 SQL INSERT INTO Statement: The INSERT INTO statement is used to insert new records in a table.  It is possible to write the INSERT INTO statement in two ways.  The first way specifies both the column names and the values to be inserted  Syntax:  If you are adding values for all the columns of the table, you do not need to specify the column names in the SQL query.  Syntax:
  • 32. SQL SELECT Statement Prof. K. Adisesha (Ph. D) 32 SQL SELECT Statement: The SELECT statement is used to select data from a database.  The data returned is stored in a result table, called the result-set.  If you want to select all the fields available in the table, use the following syntax:  The SELECT DISTINCT statement is used to return only distinct (different) values..  Syntax:  The WHERE clause is used to extract only those records that fulfill a specified condition.  Syntax:
  • 33. SQL Joins Prof. K. Adisesha (Ph. D) 33 SQL JOIN: A JOIN clause is used to combine rows from two or more tables, based on a related column between them.  Different types of the JOINs in SQL:  (INNER) JOIN: Returns records that have matching values in both tables  LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from the right table  RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records from the left table  FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table
  • 34. SQL Joins Prof. K. Adisesha (Ph. D) 34 SQL INNER JOIN: The INNER JOIN keyword selects records that have matching values in both tables.  (INNER) JOIN: Returns records that have matching values in both tables
  • 35. SQL Joins Prof. K. Adisesha (Ph. D) 35 SQL LEFT (OUTER) JOIN: The LEFT JOIN keyword returns all records from the left table (table1), and the matched records from the right table (table2).  The result is NULL from the right side, if there is no match.  LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from the right table
  • 36. SQL Joins Prof. K. Adisesha (Ph. D) 36 SQL RIGHT JOIN: The RIGHT JOIN keyword returns all records from the right table (table2), and the matched records from the left table (table1).  The result is NULL from the left side, when there is no match.  RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records from the left table
  • 37. SQL Joins Prof. K. Adisesha (Ph. D) 37 SQL FULL OUTER JOIN: The FULL OUTER JOIN keyword returns all records when there is a match in left (table1) or right (table2) table records.  FULL OUTER JOIN can potentially return very large result-sets.  FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table
  • 38. SQL ORDER BY Prof. K. Adisesha (Ph. D) 38 SQL ORDER BY Keyword: The ORDER BY keyword is used to sort the result-set in ascending or descending order.  The ORDER BY keyword sorts the records in ascending order by default. To sort the records in descending order, use the DESC keyword.
  • 39. SQL GROUP BY Prof. K. Adisesha (Ph. D) 39 SQL GROUP BY: he GROUP BY statement groups rows that have the same values into summary rows, like "find the number of customers in each country".  The GROUP BY statement is often used with aggregate functions (COUNT, MAX, MIN, SUM, AVG) to group the result-set by one or more columns.
  • 40. SQL Functions Prof. K. Adisesha (Ph. D) 40 SQL MIN() and MAX() Functions: The MIN() function returns the smallest value of the selected column.  MIN() Syntax: The MAX() function returns the largest value of the selected column.  MAX() Syntax:
  • 41. SQL Functions Prof. K. Adisesha (Ph. D) 41 SQL COUNT(), AVG() and SUM() Functions:  The COUNT() function returns the number of rows that matches a specified criterion.  The AVG() function returns the average value of a numeric column.  The SUM() function returns the total sum of a numeric column.
  • 42. Discussion Prof. K. Adisesha (Ph. D) 42 Queries ? Prof. K. Adisesha