SlideShare ist ein Scribd-Unternehmen logo
1 von 82
[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]

Weitere ähnliche Inhalte

Was ist angesagt?

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-2013Prosanta Ghosh
 
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 Constraintssontumax
 
7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMSkoolkampus
 
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 3Eddyzulham Mahluzydde
 
Module 2 - part i
Module   2 - part iModule   2 - part i
Module 2 - part iParthNavale
 
Additional Relational Algebra Operations
Additional Relational Algebra OperationsAdditional Relational Algebra Operations
Additional Relational Algebra OperationsA. S. M. Shafi
 
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-part1Eddyzulham Mahluzydde
 

Was ist angesagt? (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
 

Andere mochten auch

Andere mochten auch (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
 

Ähnlich wie Unit04 dbms (20)

SQL PPT.ppt
SQL PPT.pptSQL PPT.ppt
SQL PPT.ppt
 
RDBMS
RDBMSRDBMS
RDBMS
 
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
 
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
 
Ch3
Ch3Ch3
Ch3
 
DBMS_INTRODUCTION OF SQL
DBMS_INTRODUCTION OF SQLDBMS_INTRODUCTION OF SQL
DBMS_INTRODUCTION OF SQL
 
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
 
Ch 3.pdf
Ch 3.pdfCh 3.pdf
Ch 3.pdf
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 

Mehr von 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
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Kürzlich hochgeladen (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

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.

Hinweis der Redaktion

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