SlideShare une entreprise Scribd logo
1  sur  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]

Contenu connexe

Tendances

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
 

Tendances (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
 

En vedette (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
 

Similaire à 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
 

Plus de 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
 

Dernier

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 

Dernier (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 

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.

Notes de l'éditeur

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