csce520-lect8 - StructuredQueryLanguage SQL...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Structured Query Language SQL
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Farkas CSCE 520 2 Reading Assignments Database Systems The Complete Book: Chapters 6.1, 6.2 Oracle9 Programming: Chapters 2.1, 2.2, 2.3, 2.4 Following lecture slides are modified from Jeff Ullman’s slides  for Fall 2002 -- Stanford  
Background image of page 2
Farkas CSCE 520 3 SQL High level language Allows programmer to avoid data manipulation  details SQL queries are optimized   efficient execution SQL query answer: relation Based on set and relational operations with  certain modifications and enhancements
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Farkas CSCE 520 4 SQL Statement A typical SQL query form: SELECT  A 1 A 2 , . ..,  A n FROM   r 1 r 2 , . ..,  r m WHERE  C A i represent attributes to be returned r i represent relations C  is a condition
Background image of page 4
Farkas CSCE 520 5 SELECT SQL allows duplicates in relations as well  as in query results. To force the elimination of duplicates,  insert the keyword  distinct   after  select. The keyword  all  specifies that duplicates  not be removed.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Farkas CSCE 520 6 Example Dog-Kennel database Dog(name ,age,weight,breed ) Kennel(name ,license#,address ,phone) Owner(name, SSN ,phone) Boards(K.name,K.address,D.name,D.breed ) Owns(O.SSN,D.name, D.breed) Pays(O.SSN,  K.name,K.address,amount)
Background image of page 6
Farkas CSCE 520 7 Example List the name of the Germanshepherd  dogs SELECT  name FROM  Dog WHERE  breed=‘G.S.’; Result name Pepper Rudy-Rose
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Farkas CSCE 520 8 Meaning of Single Relation Query Begin with the relation in the FROM clause Check for satisfaction of WHERE condition If condition satisfied, apply the projection  indicated in SELECT clause 
Background image of page 8
Farkas CSCE 520 9 Operational Semantics
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/13/2011 for the course CSCE 522 taught by Professor Farkas during the Fall '11 term at South Carolina.

Page1 / 30

csce520-lect8 - StructuredQueryLanguage SQL...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online