Assignment 1 : DataBaseTotal มาช่วยสอนหน่อยดิ ทามงัย

ห้องนี้ของบัณฑิตเฟรชชี่ เมื่อปีที่แล้ว

Moderators: Spadez, Mahhow

Assignment 1 : DataBaseTotal มาช่วยสอนหน่อยดิ ทามงัย

Postby XEON » Mon Dec 03, 2007 8:17 pm

Total score: 75 pts ( 5 %)
Problem Set

The database you will use for this assignment contains information about people, vacation locations, and when those people visited them. The relations are:

Person ( ID, Name)
Location( PlaceName , Country, MainAttraction )
Visited( ID, PlaceName, Year)

You should assume that place names are unique in the world. A sample instance of this database is given below.


Person ID Name Visited ID PlaceName Year
__________________________ __________________________________
1 Aaron 1 Athens 1999
2 Betty 1 Philadelphia 2003
3 Charles 2 Philadelphia 2002
4 Dorothy 2 Seattle 2003
5 Evan 2 Agra 2004
6 Francine 3 Philadelphia 2002
3 Philadelphia 2005
4 Whistler 2006
4 Philadelphia 2004
5 Agra 2001
5 Santorini 2005
6 Sydney 2006
6 Philadelphia 2002


Location PlaceName Country MainAttraction
____________________________________________________
Sydney Australia Opera House
Agra India Taj Mahal
Whistler Canada Skiing
Santorini Greece Caldera
Athens Greece Acropolis
Philadelphia USA Cheesesteaks
Seattle USA Space Needle
1) (15 Point)
The following relational algebra and tuple relational calculus queries refer to the aforementioned schema. For each query
(a) explain in words the meaning of the result each one computes,
and (b) evaluate it over the sample instance provided.

1.1) p PlaceName Location − p PlaceName (sYear > 2003 Visited)

1.2) {T | $P( PÎ Person ^ P.Name = T.Name
^ $ V1 (V1 ÎVisited ^ $ V2 (V2 Î Visited
^ V1.ID = P.ID ^ V2.ID = P.ID
^ V1.PlaceName = T. PlaceName
^ V2.P laceName = T. PlaceName
^ V1.Year 6 ≠ V2.Y ear ))) }

1.3) (p ID, PlaceName Visited) ÷ pID Person


2) (60 point)
Write (a) relational algebra and (b) tuple relational calculus queries for each of the following. If a query is long, feel free to break it up into a series of queries with intermediate answers stored in temporary relations (e.g. “temp=.....”).


2.1) Return the names of everybody who visited Greece in 2004.

2.2) Return the names of the unfortunate people who didn’t visit anywhere at all

2.3) Return the names of the lucky people who visited all of the places listed in Location table

2.4) Return all the places that have been visited by exactly one person.
(Remember that neither the relational algebra nor the relational calculus has a “count” operation so you will have to find another way to test the “exactly one person” property.)

2.5)Return the names of the people that have visited only places that were also visited by everybody








คิดว่าเข้า copy มาจากหนังสือ Text เลยมั้ง มีใครเคยบอก อ. เปล่าว่าขอ การบ้านเป็นภาษาไทยอะ :twisted:
User avatar
XEON
Member
 
Posts: 316
Joined: Sun Apr 23, 2006 9:47 pm
Location: On the Air

Postby Remixman » Mon Dec 03, 2007 8:31 pm

เหมือนจะยังไม่เคยเรียนนะ ทำไม่ได้ก็ไม่แปลกนา
Remixman #21
The difference between stupidity and genius is that genius has its limits.

:: About Me ::
facebook : http://facebook.com/haoremixman
Blog : http://remixman.exteen.com
twitter : http://twitter.com/haoremixman
User avatar
Remixman
Member
 
Posts: 491
Joined: Tue Jul 04, 2006 4:26 pm
Location: บ้าน

Postby Poron » Mon Dec 03, 2007 8:37 pm

อ๋อ...









...ไม่เข้าใจ
บิ๊กกี้คุง #21
see me @ BiggyClub

Image
User avatar
Poron
Member
 
Posts: 609
Joined: Sun May 28, 2006 2:17 am
Location: http://biggyclub.co.cc

Postby fromme » Wed Dec 05, 2007 3:47 am

อยากรู้เหมือน ตื่นไปเรียนไม่ทัน เซงจริง
pop # 21
fromme
Member
 
Posts: 36
Joined: Fri May 26, 2006 11:10 pm
Location: ที่ที่มีข้าวกิน - -"

Postby jjmedz » Wed Dec 05, 2007 5:00 am

คนข้างบนอ่ะ คลิก แบนเนอร์ให้เรามั่งจิ

แลกกันนะ คนอื่นด้วยยย

:oops:
Image
User avatar
jjmedz
Member
 
Posts: 1787
Joined: Wed Jun 07, 2006 2:51 pm
Location: หน้าคอม

Postby fromme » Wed Dec 05, 2007 10:09 am

คลิ๊กให้แร้วนะ :D :D
pop # 21
fromme
Member
 
Posts: 36
Joined: Fri May 26, 2006 11:10 pm
Location: ที่ที่มีข้าวกิน - -"

Postby HolyShadow » Wed Dec 05, 2007 11:12 pm

กลายพันธุ์!!!!!
User avatar
HolyShadow
Administrator
 
Posts: 2024
Joined: Sun May 28, 2006 11:40 pm

Postby jjmedz » Thu Dec 06, 2007 1:38 am

ใครทำกลายพันธุ์อีกว่ะ
Image
User avatar
jjmedz
Member
 
Posts: 1787
Joined: Wed Jun 07, 2006 2:51 pm
Location: หน้าคอม

Postby HolyShadow » Thu Dec 06, 2007 7:35 pm

ตลอดอ่ะ 555
User avatar
HolyShadow
Administrator
 
Posts: 2024
Joined: Sun May 28, 2006 11:40 pm

Postby cruiser » Thu Dec 06, 2007 11:33 pm

โจทย์ถ้าแปลไม่ออกนะนักศึกษา







ก็ไปเปิด dic เอา 55555555555555+
B o w`z # 21 ♪

อันตัวข้ารักสวนฯหมดหัวใจ เลือดจะไหลเป็นสีชมพู-ฟ้า
อยากประกาศให้โลกรับรู้ว่า "สวนกุหลาบ"ของข้ายังไว้ลาย

*** กุหลาบเปลี่ยนกระถางไม่จางสี ***
User avatar
cruiser
Deleter
 
Posts: 3369
Joined: Wed May 17, 2006 5:09 pm
Location: Changmin's Heart


Return to Com-Sci#49 (CS รุ่น21)

Who is online

Users browsing this forum: No registered users and 2 guests

cron