6.830 problem set 1 geofft ----Problem 1--- 6.830=> select name from papers where lower(name) like '%coffee%' limit 10; name -------------------------------------------------------------------------------------------------------------------- Comparing commodity prices in electronic and traditional auctions: empirical evidence from Indian coffee auctions. PARALLEL-TCOFFEE: A parallel multiple sequence aligner. HGA-COFFEE : Aligning Multiple Sequences by Hybrid Genetic Algorithm. Vista: interactive coffee-corner display. ITIL capacity management: More than charts over coffee. Neurobiology 101: A One Semester in the Neurosciences Instead of a Coffee Break. Mobiles can't kiss and hug, so lets meet over coffee. CoffeeStrainer - Statically Checking Structural Constraints on Java Programs. CoffeeStrainer: Statically-Checked Constraints on the Definition and Use of Types in Java. Effects of the Office Environment on Health and Productivity 1: Effects of Coffee Corner Position. (10 rows) ----Problem 2--- 6.830=> select authors.name, papers.name from authors join paperauths on authors.id = paperauths.authid join papers on paperauths.paperid = papers.id join venue on papers.venue = venue.id where lower(papers.name) like '%coffee%' and venue.name='Commun. ACM'; name | name ----------------------+---------------------------------------------------------------------------- Asjad M. Khan | Wake up and smell the coffee: evaluation methodology for the 21st century. Rotem Bentzur | Wake up and smell the coffee: evaluation methodology for the 21st century. Daniel Feinberg | Wake up and smell the coffee: evaluation methodology for the 21st century. Amer Diwan | Wake up and smell the coffee: evaluation methodology for the 21st century. Daniel von Dincklage | Wake up and smell the coffee: evaluation methodology for the 21st century. Han Lee | Wake up and smell the coffee: evaluation methodology for the 21st century. Ben Wiedermann | Wake up and smell the coffee: evaluation methodology for the 21st century. Thomas VanDrunen | Wake up and smell the coffee: evaluation methodology for the 21st century. Maria Jump | Wake up and smell the coffee: evaluation methodology for the 21st century. Samuel Z. Guyer | Wake up and smell the coffee: evaluation methodology for the 21st century. Darko Stefanovic | Wake up and smell the coffee: evaluation methodology for the 21st century. Stephen M. Blackburn | Wake up and smell the coffee: evaluation methodology for the 21st century. J. Eliot B. Moss | Wake up and smell the coffee: evaluation methodology for the 21st century. Robin Garner | Wake up and smell the coffee: evaluation methodology for the 21st century. Daniel Frampton | Wake up and smell the coffee: evaluation methodology for the 21st century. Chris Hoffmann | Wake up and smell the coffee: evaluation methodology for the 21st century. Aashish Phansalkar | Wake up and smell the coffee: evaluation methodology for the 21st century. Kathryn S. McKinley | Wake up and smell the coffee: evaluation methodology for the 21st century. Antony L. Hosking | Wake up and smell the coffee: evaluation methodology for the 21st century. Martin Hirzel | Wake up and smell the coffee: evaluation methodology for the 21st century. (20 rows) ----Problem 3--- select papers.name from papers, paperauths join authors on paperauths.authid = authors.id where ... ----Problem 4--- 6.830=> select venue.name from venue join papers on venue.id = papers.venue join paperauths on papers.id = paperauths.paperid where paperauths.authid = (select authors.id from authors where authors.name = 'David J. DeWitt') group by venue.name order by count(*) desc limit 10; name --------------------------- SIGMOD Conference VLDB SIGMOD Record ICDE VLDB J. PDIS IEEE Trans. Software Eng. ACM Trans. Database Syst. CoRR POS (10 rows) ----Problem 5--- 6.830=> select n, count(*) from (select count(*) as n from paperauths as p1 join paperauths as p2 on p1.paperid=p2.paperid and p1.authid= m and (select n from paperauths where id1 = p1.authid and id2 = p3.authid) >= m and ... and (select n from paperauths where id1 = p{n-1}.authid and id2 = pn.authid) >= m SQL doesn't provide a way to take the row [p1, p2, ..., pn] and transpose it for the self-join, so we need to list the n^2 where clauses manually. If we could transpose it into a table authsubset, then we could join coauth with (authsubset as a1, authsubset as a2) on id1 = a1.id and id2 = a2.id, and ensure that count(*) where n