SlideShare a Scribd company logo
[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
History ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Data Definition Language ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Allows the specification of:
Create Table Construct ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Domain Types in SQL ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Integrity Constraints on Tables ,[object Object],[object Object],Example:  Declare  branch_name  as the primary key for  branch . create table  branch   ( branch_name char(15) ,   branch_city char(30)  not null ,   assets integer,   primary key  ( branch_name )) primary key  declaration on an attribute automatically ensures  not null  in SQL-92 onwards, needs to be explicitly stated in SQL-89
Basic Insertion and Deletion of Tuples ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Drop and Alter Table Constructs ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic Query Structure  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The select Clause ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The select Clause (Cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The select Clause (Cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object]
The where Clause ,[object Object],[object Object],[object Object],[object Object],[object Object]
The from Clause ,[object Object],[object Object],[object Object],[object Object],[object Object],select  customer_name, borrower.loan_number, amount   from  borrower, loan   where  borrower.loan_number = loan.loan_number  and   branch_name =  'Perryridge'
The Rename Operation ,[object Object],[object Object],[object Object],select  customer_name, borrower.loan_number  as  loan_id, amount from  borrower, loan where  borrower.loan_number = loan.loan_number
Tuple Variables ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],select  customer_name, T.loan_number, S.amount   from  borrower  as  T, loan  as  S   where  T.loan_number = S.loan_number
Example Instances ,[object Object],[object Object],R1 S1 S2
Basic SQL Query ,[object Object],[object Object],[object Object],[object Object],SELECT  [DISTINCT]  target-list FROM   relation-list WHERE  qualification
Conceptual Evaluation Strategy ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example of Conceptual Evaluation SELECT   S.sname FROM  Sailors S, Reserves R WHERE   S.sid=R.sid  AND  R.bid=103
A Note on Range Variables ,[object Object],SELECT   S.sname FROM  Sailors S, Reserves R WHERE   S.sid=R.sid  AND  bid=103 SELECT   sname FROM  Sailors, Reserves  WHERE   Sailors.sid=Reserves.sid AND  bid=103 It is good style, however, to use range variables always! OR
Find sailors who’ve reserved at least one boat ,[object Object],[object Object],SELECT   S.sid FROM   Sailors S, Reserves R WHERE   S.sid=R.sid
Expressions and Strings ,[object Object],[object Object],[object Object],SELECT   S.age, age1=S.age-5, 2*S.age  AS  age2 FROM   Sailors S WHERE   S.sname  LIKE  ‘B_%B’
String Operations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Ordering the Display of Tuples ,[object Object],[object Object],[object Object],[object Object]
Duplicates ,[object Object],[object Object],[object Object],[object Object],[object Object]
Duplicates (Cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Set Operations ,[object Object],[object Object],[object Object],[object Object],[object Object]
Set Operations ,[object Object],( select   customer_name  from  depositor ) except (select   customer_name  from  borrower) ( select   customer_name  from  depositor ) intersect (select   customer_name  from  borrower) ,[object Object],(select   customer_name  from  depositor ) union (select   customer_name  from  borrower) ,[object Object]
Find sid’s of sailors who’ve reserved a red  or  a green boat ,[object Object],[object Object],[object Object],SELECT   S.sid FROM   Sailors S, Boats B, Reserves R WHERE  S.sid=R.sid  AND  R.bid=B.bid AND  (B.color=‘red’  OR  B.color=‘green’) SELECT   S.sid FROM  Sailors S, Boats B, Reserves R WHERE   S.sid=R.sid  AND  R.bid=B.bid AND  B.color=‘red’ UNION SELECT   S.sid FROM  Sailors S, Boats B, Reserves R WHERE   S.sid=R.sid  AND  R.bid=B.bid AND  B.color=‘green’
Find sid’s of sailors who’ve reserved a red  and  a green boat ,[object Object],[object Object],[object Object],SELECT   S.sid FROM   Sailors S, Boats B1, Reserves R1, Boats B2, Reserves R2 WHERE  S.sid=R1.sid  AND  R1.bid=B1.bid AND  S.sid=R2.sid  AND  R2.bid=B2.bid AND  (B1.color=‘red’  AND  B2.color=‘green’) SELECT   S.sid FROM  Sailors S, Boats B, Reserves R WHERE   S.sid=R.sid  AND  R.bid=B.bid AND  B.color=‘red’ INTERSECT SELECT   S.sid FROM  Sailors S, Boats B, Reserves R WHERE   S.sid=R.sid  AND  R.bid=B.bid AND  B.color=‘green’ Key field!
Nested Queries ,[object Object],[object Object],[object Object],SELECT  S.sname FROM   Sailors S WHERE  S.sid  IN   ( SELECT   R.sid FROM   Reserves R WHERE   R.bid=103) Find names of sailors who’ve reserved boat #103:
Nested Queries with Correlation ,[object Object],[object Object],[object Object],SELECT  S.sname FROM   Sailors S WHERE  EXISTS   ( SELECT   * FROM   Reserves R WHERE   R.bid=103  AND   S.sid =R.sid) Find names of sailors who’ve reserved boat #103:
Aggregate Functions ,[object Object],[object Object]
Aggregate Functions (Cont.) ,[object Object],[object Object],[object Object],select avg  (balance) from  account where  branch_name =  'Perryridge'  select count  (*) from  customer select count (distinct  customer_name) from  depositor
Aggregate Functions – Group By ,[object Object],Note:  Attributes in  select  clause outside of aggregate functions must    appear in  group by  list select  branch_name,  count (distinct   customer_name)   from  depositor, account   where  depositor.account_number = account.account_number   group by  branch_name
Aggregate Functions – Having Clause ,[object Object],Note:  predicates in the  having  clause are applied after the    formation of groups whereas predicates in the  where     clause are applied before forming groups select  branch_name,  avg  ( balance )   from  account   group by  branch_name   having avg   ( balance )  >  1200
Nested Subqueries ,[object Object],[object Object],[object Object]
“In” Construct ,[object Object],[object Object],select distinct  customer_name from  borrower where  customer_name  not in  ( select  customer_name   from  depositor  ) select distinct  customer_name from  borrower where  customer_name  in  ( select  customer_name   from   depositor  )
Example Query ,[object Object],[object Object],select distinct   customer_name from  borrower, loan where  borrower.loan_number = loan.loan_number  and     branch_name =  'Perryridge'  and   ( branch_name, customer_name  )   in (select  branch_name, customer_name   from  depositor, account   where  depositor.account_number =    account.account_number  )
“Some” Construct ,[object Object],[object Object],select  branch_name from  branch where  assets >  some   (select  assets     from  branch   where  branch_city =  ' Brooklyn ' )  select distinct  T.branch_name from  branch  as  T, branch  as  S where  T.assets > S.assets  and   S.branch_city =  ' Brooklyn '
“All” Construct ,[object Object],select  branch_name from  branch where  assets >  all (select  assets from  branch where  branch_city =  'Brooklyn')
“Exists” Construct ,[object Object],select distinct  S.customer_name from  depositor  as  S where not exists  ( ( select  branch_name from  branch where  branch_city =  'Brooklyn')    except ( select  R.branch_name from  depositor  as  T, account  as  R where  T.account_number = R.account_number  and S.customer_name = T.customer_name  )) ,[object Object],[object Object]
Absence of Duplicate Tuples ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example Query ,[object Object],select distinct  T.customer_name from  depositor  as  T where not unique  ( select  R.customer_name from  account, depositor  as  R where  T.customer_name  = R.customer_name  and   R.account_number = account.account_number  and   account.branch_name =   ' Perryridge ' )  ,[object Object]
Modification of the Database – Deletion ,[object Object],[object Object],[object Object],[object Object]
Example Query ,[object Object],delete from  account   where  balance  < ( select avg  ( balance  )   from  account  ) ,[object Object],[object Object],[object Object],[object Object]
Modification of the Database – Insertion ,[object Object],[object Object],[object Object],[object Object],[object Object]
Modification of the Database – Insertion ,[object Object],[object Object],[object Object],[object Object]
Modification of the Database – Updates ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Case Statement for Conditional Updates ,[object Object],[object Object]
More on Set-Comparison Operators ,[object Object],[object Object],[object Object],SELECT   * FROM   Sailors S WHERE   S.rating  >  ANY   ( SELECT   S2.rating FROM   Sailors S2 WHERE  S2.sname=‘Horatio’)
Rewriting  INTERSECT  Queries Using  IN ,[object Object],[object Object],Find sid’s of sailors who’ve reserved both a red and a green boat: SELECT   S.sid FROM   Sailors S, Boats B, Reserves R WHERE   S.sid=R.sid  AND  R.bid=B.bid  AND  B.color=‘red’ AND  S.sid  IN   ( SELECT   S2.sid FROM   Sailors S2, Boats B2, Reserves R2 WHERE   S2.sid=R2.sid  AND  R2.bid=B2.bid AND   B2.color=‘green’)
Division in SQL ,[object Object],SELECT   S.sname FROM   Sailors S WHERE  NOT EXISTS  (( SELECT   B.bid FROM  Boats B) EXCEPT ( SELECT   R.bid FROM   Reserves R WHERE   R.sid=S.sid)) SELECT   S.sname FROM   Sailors S WHERE  NOT EXISTS  ( SELECT   B.bid FROM   Boats B  WHERE  NOT EXISTS  ( SELECT   R.bid FROM   Reserves R WHERE   R.bid=B.bid AND  R.sid=S.sid)) Sailors S such that ... there is no boat B without ... a Reserves tuple showing S reserved B Find sailors who’ve reserved all boats. (1) (2)
Aggregate Operators ,[object Object],COUNT  (*) COUNT  ( [ DISTINCT ] A) SUM  ( [ DISTINCT ] A) AVG  ( [ DISTINCT ] A) MAX  (A) MIN  (A) SELECT  AVG  (S.age) FROM   Sailors S WHERE   S.rating=10 SELECT  COUNT  (*) FROM   Sailors S SELECT  AVG  (  DISTINCT  S.age) FROM   Sailors S WHERE   S.rating=10 SELECT   S.sname FROM   Sailors S WHERE   S.rating= ( SELECT  MAX (S2.rating) FROM   Sailors S2) single   column SELECT  COUNT  ( DISTINCT  S.rating) FROM   Sailors S WHERE  S.sname=‘Bob’
Find name and age of the oldest sailor(s) ,[object Object],[object Object],SELECT   S.sname,  MAX  (S.age) FROM   Sailors S SELECT   S.sname, S.age FROM   Sailors S WHERE   S.age = ( SELECT  MAX  (S2.age) FROM   Sailors S2) SELECT   S.sname, S.age FROM   Sailors S WHERE   ( SELECT  MAX  (S2.age) FROM   Sailors S2) = S.age
Motivation for Grouping ,[object Object],[object Object],[object Object],[object Object],SELECT  MIN (S.age) FROM  Sailors S WHERE  S.rating =  i For  i  = 1, 2, ... , 10:
Queries With  GROUP BY  and  HAVING ,[object Object],[object Object],SELECT  [DISTINCT]  target-list FROM   relation-list WHERE  qualification GROUP BY   grouping-list HAVING  group-qualification
Conceptual Evaluation ,[object Object],[object Object],[object Object],[object Object]
Find age of the youngest sailor with age  18, for each rating with at least 2  such  sailors SELECT   S.rating,  MIN  (S.age)  AS  minage FROM   Sailors S WHERE  S.age >= 18 GROUP BY  S.rating HAVING   COUNT  (*) > 1 Answer relation: Sailors instance:
Find age of the youngest sailor with age  18, for each rating with at least 2  such  sailors.
Find age of the youngest sailor with age  18, for each rating with at least 2  such  sailors and with every sailor under 60. HAVING  COUNT (*) > 1 AND EVERY (S.age <=60) What is the result of  changing EVERY to ANY?
Find age of the youngest sailor with age  18, for each rating with at least 2 sailors between 18 and 60. SELECT   S.rating,  MIN  (S.age)  AS  minage FROM   Sailors S WHERE  S.age >= 18 AND S.age <= 60 GROUP BY  S.rating HAVING   COUNT  (*) > 1 Answer relation: Sailors instance:
For each red boat, find the number of reservations for this boat ,[object Object],[object Object],[object Object],SELECT   B.bid,  COUNT  (*) AS scount FROM   Sailors S, Boats B, Reserves R WHERE  S.sid=R.sid  AND  R.bid=B.bid  AND  B.color=‘red’ GROUP BY  B.bid
Find age of the youngest sailor with age > 18,  for each rating with at least 2 sailors (of any age) ,[object Object],[object Object],[object Object],[object Object],SELECT   S.rating ,  MIN  (S.age) FROM   Sailors S WHERE   S.age > 18 GROUP BY  S.rating HAVING   1  <  ( SELECT  COUNT  (*) FROM   Sailors S2 WHERE   S.rating=S2.rating )
Find those ratings for which the average age is the minimum over all ratings ,[object Object],SELECT  S.rating FROM  Sailors S WHERE  S.age =  ( SELECT  MIN  ( AVG  (S2.age))  FROM  Sailors S2) SELECT   Temp.rating, Temp.avgage FROM   ( SELECT   S.rating,  AVG  (S.age)  AS  avgage FROM   Sailors S GROUP BY  S.rating)  AS  Temp WHERE   Temp.avgage = ( SELECT  MIN  (Temp.avgage) FROM   Temp) ,[object Object]
Null Values ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Null Values ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Null Values and Three Valued Logic ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Null Values and Aggregates ,[object Object],[object Object],[object Object],[object Object],[object Object]
Joined Relations** ,[object Object],[object Object],[object Object],[object Object]
Joined Relations – Datasets for Examples ,[object Object],[object Object],[object Object]
Joined Relations – Examples  ,[object Object],[object Object]
Joined Relations – Examples ,[object Object],[object Object],[object Object],select  customer_name from  ( depositor  natural full outer join  borrower  ) where  account_number  is null or  loan_number  is null
Joined Relations – Examples ,[object Object],[object Object],[object Object],[object Object]
Derived Relations ,[object Object],[object Object],[object Object],[object Object]
Integrity Constraints (Review) ,[object Object],[object Object],[object Object],[object Object],[object Object]
General Constraints ,[object Object],[object Object],[object Object],CREATE TABLE  Sailors ( sid  INTEGER, sname  CHAR(10), rating   INTEGER, age   REAL, PRIMARY KEY  (sid), CHECK   ( rating >= 1  AND  rating <= 10 )   CREATE TABLE  Reserves ( sname  CHAR(10), bid  INTEGER, day  DATE, PRIMARY KEY  (bid,day), CONSTRAINT   noInterlakeRes CHECK  (`Interlake’ <> ( SELECT  B.bname FROM  Boats B WHERE  B.bid=bid)))
Constraints Over Multiple Relations ,[object Object],[object Object],[object Object],CREATE TABLE  Sailors ( sid  INTEGER, sname  CHAR(10), rating  INTEGER, age  REAL, PRIMARY KEY  (sid), CHECK  ( (SELECT COUNT (S.sid) FROM Sailors S) + (SELECT COUNT (B.bid) FROM Boats B) < 100 )   CREATE ASSERTION   smallClub CHECK  ( (SELECT COUNT (S.sid) FROM Sailors S) + (SELECT COUNT (B.bid) FROM Boats B) < 100 ) Number of boats plus number of  sailors is < 100
Triggers ,[object Object],[object Object],[object Object],[object Object],[object Object]
Triggers: Example (SQL:1999) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013
Prosanta Ghosh
 
Ch4
Ch4Ch4
The Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database ConstraintsThe Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database Constraints
sontumax
 
7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMSkoolkampus
 
Assignment#04
Assignment#04Assignment#04
Assignment#04
Sunita Milind Dol
 
Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3
Eddyzulham Mahluzydde
 
Module 2 - part i
Module   2 - part iModule   2 - part i
Module 2 - part i
ParthNavale
 
Additional Relational Algebra Operations
Additional Relational Algebra OperationsAdditional Relational Algebra Operations
Additional Relational Algebra Operations
A. S. M. Shafi
 
dbms first unit
dbms first unitdbms first unit
dbms first unit
Raghu Bright
 
SQL
SQLSQL
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
Radhika Talaviya
 
Assignment#08
Assignment#08Assignment#08
Assignment#08
Sunita Milind Dol
 
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
Raj vardhan
 
Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1
Eddyzulham Mahluzydde
 
Assignment#07
Assignment#07Assignment#07
Assignment#07
Sunita Milind Dol
 

What's hot (18)

Ch3
Ch3Ch3
Ch3
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013
 
Ch4
Ch4Ch4
Ch4
 
Sql.pptx
Sql.pptxSql.pptx
Sql.pptx
 
The Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database ConstraintsThe Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database Constraints
 
7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMS
 
Assignment#04
Assignment#04Assignment#04
Assignment#04
 
Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3
 
Module 2 - part i
Module   2 - part iModule   2 - part i
Module 2 - part i
 
Additional Relational Algebra Operations
Additional Relational Algebra OperationsAdditional Relational Algebra Operations
Additional Relational Algebra Operations
 
dbms first unit
dbms first unitdbms first unit
dbms first unit
 
SQL
SQLSQL
SQL
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
Assignment#08
Assignment#08Assignment#08
Assignment#08
 
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
 
Integrity and security
Integrity and securityIntegrity and security
Integrity and security
 
Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1
 
Assignment#07
Assignment#07Assignment#07
Assignment#07
 

Viewers also liked

NVCPA Conference - "How Thieves Break In" 10-4-11
NVCPA Conference - "How Thieves Break In"   10-4-11NVCPA Conference - "How Thieves Break In"   10-4-11
NVCPA Conference - "How Thieves Break In" 10-4-11
Dale Bowman, CPP, PSP, CML, CJIL
 
Locks with updt nowait
Locks with updt nowaitLocks with updt nowait
Locks with updt nowaitavniS
 
Senior project pres.
Senior project pres.Senior project pres.
Senior project pres.Selena Maddox
 

Viewers also liked (7)

Sp speech
Sp speechSp speech
Sp speech
 
Unit1 C
Unit1 CUnit1 C
Unit1 C
 
Les04
Les04Les04
Les04
 
NVCPA Conference - "How Thieves Break In" 10-4-11
NVCPA Conference - "How Thieves Break In"   10-4-11NVCPA Conference - "How Thieves Break In"   10-4-11
NVCPA Conference - "How Thieves Break In" 10-4-11
 
Locks with updt nowait
Locks with updt nowaitLocks with updt nowait
Locks with updt nowait
 
Senior project pres.
Senior project pres.Senior project pres.
Senior project pres.
 
Les02
Les02Les02
Les02
 

Similar to Unit04 dbms

SQL PPT.ppt
SQL PPT.pptSQL PPT.ppt
SQL PPT.ppt
hemamalinikrishnan2
 
RDBMS
RDBMSRDBMS
RDBMS
NilaNila16
 
UNIT 2 Structured query language commands
UNIT 2 Structured query language commandsUNIT 2 Structured query language commands
UNIT 2 Structured query language commands
Bhakti Pawar
 
relational model in Database Management.ppt.ppt
relational model in Database Management.ppt.pptrelational model in Database Management.ppt.ppt
relational model in Database Management.ppt.ppt
Roshni814224
 
ch3[1].ppt
ch3[1].pptch3[1].ppt
ch3[1].ppt
IndraThanaya1
 
SQL - Structured query language introduction
SQL - Structured query language introductionSQL - Structured query language introduction
SQL - Structured query language introduction
Smriti Jain
 
3. Relational Models in DBMS
3. Relational Models in DBMS3. Relational Models in DBMS
3. Relational Models in DBMSkoolkampus
 
3.ppt
3.ppt3.ppt
Details of RDBMS.ppt
Details of RDBMS.pptDetails of RDBMS.ppt
Details of RDBMS.ppt
ShivareddyGangam
 
relational algebra and it's implementation
relational algebra and it's implementationrelational algebra and it's implementation
relational algebra and it's implementation
dbmscse61
 
Sql server select queries ppt 18
Sql server select queries ppt 18Sql server select queries ppt 18
Sql server select queries ppt 18
Vibrant Technologies & Computers
 
Relation model part 1
Relation model part 1Relation model part 1
Relation model part 1
Siti Ismail
 
DBMS_INTRODUCTION OF SQL
DBMS_INTRODUCTION OF SQLDBMS_INTRODUCTION OF SQL
DBMS_INTRODUCTION OF SQL
Azizul Mamun
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
rahulnadola3
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
DHAAROUN
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
poovathi nps
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
pradnyamulay
 

Similar to Unit04 dbms (20)

SQL PPT.ppt
SQL PPT.pptSQL PPT.ppt
SQL PPT.ppt
 
RDBMS
RDBMSRDBMS
RDBMS
 
UNIT 2 Structured query language commands
UNIT 2 Structured query language commandsUNIT 2 Structured query language commands
UNIT 2 Structured query language commands
 
relational model in Database Management.ppt.ppt
relational model in Database Management.ppt.pptrelational model in Database Management.ppt.ppt
relational model in Database Management.ppt.ppt
 
Unit 04 dbms
Unit 04 dbmsUnit 04 dbms
Unit 04 dbms
 
ch3[1].ppt
ch3[1].pptch3[1].ppt
ch3[1].ppt
 
SQL - Structured query language introduction
SQL - Structured query language introductionSQL - Structured query language introduction
SQL - Structured query language introduction
 
3. Relational Models in DBMS
3. Relational Models in DBMS3. Relational Models in DBMS
3. Relational Models in DBMS
 
3.ppt
3.ppt3.ppt
3.ppt
 
Details of RDBMS.ppt
Details of RDBMS.pptDetails of RDBMS.ppt
Details of RDBMS.ppt
 
relational algebra and it's implementation
relational algebra and it's implementationrelational algebra and it's implementation
relational algebra and it's implementation
 
Sql server select queries ppt 18
Sql server select queries ppt 18Sql server select queries ppt 18
Sql server select queries ppt 18
 
Relation model part 1
Relation model part 1Relation model part 1
Relation model part 1
 
DBMS_INTRODUCTION OF SQL
DBMS_INTRODUCTION OF SQLDBMS_INTRODUCTION OF SQL
DBMS_INTRODUCTION OF SQL
 
Ch3
Ch3Ch3
Ch3
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 

More from arnold 7490 (20)

Les14
Les14Les14
Les14
 
Les13
Les13Les13
Les13
 
Les11
Les11Les11
Les11
 
Les10
Les10Les10
Les10
 
Les09
Les09Les09
Les09
 
Les07
Les07Les07
Les07
 
Les06
Les06Les06
Les06
 
Les05
Les05Les05
Les05
 
Les03
Les03Les03
Les03
 
Les01
Les01Les01
Les01
 
Les12
Les12Les12
Les12
 
Unit 8 Java
Unit 8 JavaUnit 8 Java
Unit 8 Java
 
Unit 6 Java
Unit 6 JavaUnit 6 Java
Unit 6 Java
 
Unit 5 Java
Unit 5 JavaUnit 5 Java
Unit 5 Java
 
Unit 4 Java
Unit 4 JavaUnit 4 Java
Unit 4 Java
 
Unit 3 Java
Unit 3 JavaUnit 3 Java
Unit 3 Java
 
Unit 2 Java
Unit 2 JavaUnit 2 Java
Unit 2 Java
 
Unit 1 Java
Unit 1 JavaUnit 1 Java
Unit 1 Java
 
Unit 7 Java
Unit 7 JavaUnit 7 Java
Unit 7 Java
 
Unit6 C
Unit6 C Unit6 C
Unit6 C
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 

Unit04 dbms

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. Example of Conceptual Evaluation SELECT S.sname FROM Sailors S, Reserves R WHERE S.sid=R.sid AND R.bid=103
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61. Find age of the youngest sailor with age 18, for each rating with at least 2 such sailors SELECT S.rating, MIN (S.age) AS minage FROM Sailors S WHERE S.age >= 18 GROUP BY S.rating HAVING COUNT (*) > 1 Answer relation: Sailors instance:
  • 62. Find age of the youngest sailor with age 18, for each rating with at least 2 such sailors.
  • 63. Find age of the youngest sailor with age 18, for each rating with at least 2 such sailors and with every sailor under 60. HAVING COUNT (*) > 1 AND EVERY (S.age <=60) What is the result of changing EVERY to ANY?
  • 64. Find age of the youngest sailor with age 18, for each rating with at least 2 sailors between 18 and 60. SELECT S.rating, MIN (S.age) AS minage FROM Sailors S WHERE S.age >= 18 AND S.age <= 60 GROUP BY S.rating HAVING COUNT (*) > 1 Answer relation: Sailors instance:
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.

Editor's Notes

  1. 2
  2. 3
  3. 4
  4. 5
  5. 6
  6. 8
  7. 9
  8. 10
  9. 5
  10. 8
  11. 9