ics321-20090915-sql1 - ICS 321 Fall 2009 SQL Queries...

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

View Full Document Right Arrow Icon
ICS 321 Fall 2009 SQL: Queries, Constraints, Triggers Asst. Prof. Lipyeow Lim University of Hawaii at Manoa 9/8/2009 1 Lipyeow Lim -- University of Hawaii at Manoa
Background image of page 1

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

View Full DocumentRight Arrow Icon
Example Relations Sailors( sid: integer, sname: string, rating: integer, age: real) Boats( bid: integer, bname: string, color: string) Reserves( sid: integer, bid: string, day: date) sid bid day 22 101 10/10/96 58 103 11/12/96 9/8/2009 Lipyeow Lim -- University of Hawaii at Manoa 2 sid sname rating age 22 Dustin 7 45.0 31 Lubber 8 55.5 58 Rusty 10 35.0 R1 S1 bid bname color 101 Interlake Blue 102 Interlake Red 103 Clipper green 104 Marine Red B1
Background image of page 2
Basic SQL Query relation-list A list of relation names (possibly with a range-variable after each name). target-list A list of attributes of relations in relation-list qualification Comparisons (Attr op const or Attr1 op Attr2, where op is one of <, >, ≤, ≥, =, ≠) combined using AND, OR and NOT . DISTINCT is an optional keyword indicating that the answer should not contain duplicates. Default is that duplicates are not eliminated! 9/8/2009 Lipyeow Lim -- University of Hawaii at Manoa 3 SELECT [ DISTINCT ] target-list FROM relation-list WHERE qualification
Background image of page 3

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

View Full DocumentRight Arrow Icon
Example Q1 Range variables really needed only if the same relation appears twice in the FROM clause. Good style to always use range variables 9/8/2009 Lipyeow Lim -- University of Hawaii at Manoa 4 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 Without range variables
Background image of page 4
Conceptual Evaluation Strategy Semantics of an SQL query defined in terms of the following conceptual evaluation strategy: 1. Compute the cross-product of relation-list . 2.
Background image of page 5

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

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

This note was uploaded on 11/15/2010 for the course ICS 321 taught by Professor Lim during the Fall '09 term at University of Hawaii, Manoa.

Page1 / 18

ics321-20090915-sql1 - ICS 321 Fall 2009 SQL Queries...

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

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