Assign2 Ods
Assign2 Ods
], ...
... ON [ owner.]table-name TO userid, ... [ WITH GRANT
OPTION]
Question 1
Part2
SELECT COUNT(StudentID)AS StuID,DegreeNAME, FROM SciFac
WHERE
NumberOfYears = 3 AND
StudentID<>like”01%” AND
GROUP BY DegreeName
Question 2
• Declarative Ease
• Centralised Rules
• Superior Performance
Question 3
= 4+2+30++2+2
= 40 bytes
There are 200 rows in the degree table
= (2048 – 32)/40
= 2016/40
= 50.4
= 51 records
= 4+8+30+10+2+30
=84 bytes
= 50000/(75% * 24)
= 50000/ 18
= 2777.77777778
= 2778 data pages
Primary index
Since index pages are only 75% full the fan out would be
155*75% = 116.25 on average index records per page
= 23.8967777
= 24 leaf pages + 1 for root
Secondary Index
Since index records are only 75% full the fan out is
50000/216 = 231.48148
= 232 second level leaf pages + 1 for root
= 24 + 1 + 232 + 1
= 258 pages
= 6 + 2778 + 258
= 3042 pages
In bytes
3042*2048
= 6,230,016 bytes
ii) From part 1 there are 216 index records in each leaf
page on average
Now we take 10% of 50000 records = 5000