454.3-09.Solution3

454.3-09.Solution3 - CMPT-454 Fall 2009 Instructor: Martin...

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

View Full Document Right Arrow Icon
CMPT-454 Fall 2009 Instructor: Martin Ester TA: Yi Liu Solution Assignment 3 Total marks: 200 (20 % of the assignments) Due date: October 28, 2009 Problem 3.1 (30 marks) Consider the following simplified grammar for SQL queries. <Query>::=SELECT <SelList> FROM <FromList> WHERE <Condition> <SelList>::= <Attribute>, <SelList> <SelList>::= <Attribute> <FromList>::= <Relation>, <FromList> <FromList>::= <Relation> <Condition>::= <Condition> AND <Condition> <Condition>::= <Attribute> IN (<Query>) <Condition>::= <Attribute> = <Attribute> <Condition>::= <Attribute> LIKE <Pattern> <Relation> and <Attribute> are defined as names of relations / attributes in the database schema. <Pattern> is defined as a regular string expression. Give the parse tree for the following SQL query over relations R(a,b) and S(b,c): SELECT a FROM R WHERE b IN (SELECT a FROM R, S WHERE R.b=S.b);
Background image of page 1

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

View Full DocumentRight Arrow Icon
<Query> SELECT <SelList> FROM <FromList> WHERE <Condition> <Attribute> <Relation> <Attribute> IN ( <Query> ) a R b SELECT <SelList> FROM <FromList> WHERE <Condition> <Attribute> <Relation> , <FromList>
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/23/2009 for the course CS 307 taught by Professor A.bulatov during the Spring '09 term at Simon Fraser.

Page1 / 5

454.3-09.Solution3 - CMPT-454 Fall 2009 Instructor: Martin...

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

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