Saints in our Book can be queried by morphing the data into a table, but i find myself much too lazy to go through all those steps it each time i want to look. Javascript can be used to find some things like ties but is not queryable. However, it can be used together to create a ready-to-execute query:

// ==UserScript== // @name Perlmonks Saints in our Book to Oracle // @namespace http://www.example.com/chacham/ // @description Turn the data imn Perlmonks Saints in our Book into an + Oracle quey with CTEs // @include http://perlmonks.org/?node_id=3559 // @version 1 // @grant none // ==/UserScript== var query = "WITH\n\tData(Ranking, Name, XP, Writeups)\nAS\n\t("; var table = document.getElementsByTagName('table')[4]; for(var row = 1; row < table.rows.length; row++) query += "\n\t SELECT " + table.rows[row].cells[0].textContent + ",\t'" + table.rows[row].cells[1].textContent + "',\t" + table.rows[row].cells[2].textContent + ",\t" + table.rows[row].cells[4].textContent.replace('None', 0) + "\t FROM + Dual UNION ALL"; // Chop off the extra UNION ALL query = query.slice(0, -10) + "\n\t),\n\tStep_XP_Writeups(Ranking, Name, XP, Writeups, XP_Diff, Wr +iteups_Diff) \ \nAS \ \n\t( \ \n\t SELECT \ \n\t\tRanking, \ \n\t\tName, \ \n\t\tXP, \ \n\t\tWriteups, \ \n\t\tXP - LEAD(XP) OVER(ORDER BY Ranking), \ \n\t\tWriteups - LEAD(Writeups) OVER(ORDER BY Ranking) \ \n\t FROM \ \n\t\tData \ \n), \ \n\tClose(Ranking, XP_Diff, Writeups_Diff) \ \nAS \ \n\t( \ \n\t SELECT \ \n\t\tRanking, \ \n\t\tXP - LEAD(XP) OVER(ORDER BY Ranking), \ \n\t\tWriteups - LEAD(Writeups) OVER(ORDER BY Ranking) \ \n\t FROM \ \n\t\tStep_XP_Writeups \ \n\t WHERE \ \n\t\tXP_Diff\tBETWEEN -30 AND 30 \ \n\t AND\tWriteups_Diff\tBETWEEN -5 AND 5 \ \n), \ \n\tMMA(XP_Diff_Min, XP_Diff_Max, XP_Diff_Avg, Writeups_Diff_Min, Writ +eups_Diff_Max, Writeups_Diff_Avg)\ \nAS \ \n\t( \ \n\t SELECT \ \n\t\tMIN(XP_Diff), \ \n\t\tMAX(XP_Diff), \ \n\t\tAVG(XP_Diff), \ \n\t\tMIN(Writeups_Diff), \ \n\t\tMAX(Writeups_Diff), \ \n\t\tAVG(Writeups_Diff) \ \n\t FROM \ \n\t\tStep_XP_Writeups \ \n\t), \ \n\tStats(Both, Close, XP, XP_Diff_Min, XP_Diff_Max, XP_Diff_Avg, Writ +eups, Writeups_Diff_Min, Writeups_Diff_Max, Writeups_Diff_Avg) \ \nAS \ \n\t( \ \n\t SELECT \ \n\t(SELECT COUNT(COUNT(*)) FROM Data GROUP BY XP, Writeups HAV +ING Count(*) > 1), \ \n\t(SELECT COUNT(*) FROM Close), \ \n\t(SELECT COUNT(COUNT(*)) FROM Data GROUP BY XP HAVING Count(*) +> 1), \ \n\tXP_Diff_Min, \ \n\tXP_Diff_Max, \ \n\tXP_Diff_Avg, \ \n\t(SELECT COUNT(COUNT(*)) FROM Data GROUP BY Writeups HAVING Cou +nt(*) > 1) Writeups, \ \n\tWriteups_Diff_Min, \ \n\tWriteups_Diff_Max, \ \n\tWriteups_Diff_Avg \ \n FROM \ \n\tMMA\n\t) \ \n--SELECT Both, Close, XP, XP_Diff_Min, XP_Diff_Max, XP_Diff_Avg, Wri +teups, Writeups_Diff_Min, Writeups_Diff_Max, Writeups_Diff_Avg FROM S +tats \ \nSELECT \ \n\tData.Ranking, \ \n\tData.Name, \ \n\tData.XP, \ \n\tData.Writeups \ \nFROM \ \n\tData, \n\tClose \ \nWHERE \ \n\tData.Ranking BETWEEN Close.Ranking AND Close.Ranking + 1 \ \nORDER BY \ \n\tData.Ranking;"; var textarea = document.createElement('textarea'); textarea.cols = 100; textarea.rows = 20; textarea.value = query; document.body.appendChild(textarea);

Ugly, though effective, it plops a textarea at the bottom of the page with a query (easily adaptable to your RDBMS.)

Added on OpenUsersJS at Perlmonks Saints in our Book to Oracle

The query, due to the primary CTE, should be relatively easy to modify for more specific purposes.


In reply to Querying Saints in our Book by chacham

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.