databases homework

7
Databases Homework Go to http://sqlzoo.net / • Do as much as you can in 2 hours • Let me know what you did by email – No need to send me lots of screen shots – Just summarize your experience (good, bad, ugly)

Upload: harlan

Post on 23-Feb-2016

31 views

Category:

Documents


0 download

DESCRIPTION

Databases Homework. Go to http://sqlzoo.net / Do as much as you can in 2 hours Let me know what you did by email No need to send me lots of screen shots Just summarize your experience (good, bad, ugly). - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Databases Homework

Databases Homework

• Go to http://sqlzoo.net/ • Do as much as you can in 2 hours• Let me know what you did by email– No need to send me lots of screen shots– Just summarize your experience (good, bad, ugly)

Page 2: Databases Homework

Cloud Computing: Cosmos, Scope http://research.microsoft.com/en-us/um/people/jrzhou/pub/Scope.pdf

SELECT query, COUNT(*) AS countFROM "search.log" USING LogExtractor GROUP BY query HAVING count > 1000 ORDER BY count DESC; OUTPUT TO "qcount.result";

Page 3: Databases Homework

SQL: Stupid Query Languagehttp://www.skrause.org/humor/computerjargon.shtml

http://www.w3schools.com/sql/default.asp

Page 4: Databases Homework

125M Tweetsmysql -utfinin -ppsdHsyxwNXNJTMFt tfinin

show tables; describe statuses;select text from statuses limit 10;select text from statuses like ‘%joke%’ limit 10;select name from users

where name > ‘aaa’ and name < ‘aab’describe statuses; describe users;select id,name from users limit 10;select user_id,text from statuses limit 10;select count(*) from users;select count(*) from statuses;

Page 5: Databases Homework

Joinsselect name, text

from users u, statuses s where u.id = s.user_id and text like '%joke%' limit 10;

select user_id, count(*) as n from statuses group by user_id having n > 10000 order by n desc;

create view heavy_users as select user_id, count(*) as n from statuses group by user_id having n > 10000;

select * from heavy_users;

select name,n from users,heavy_userswhere users.id = heavy_users.user_idorder by n desc;

select name,text from users,statuses where users.id = statuses.user_id and name = 'freelancejobz' limit 100;

Page 7: Databases Homework

Blist (B-Trees in Python) http://pypi.python.org/pypi/blist