Quiz Answer Key and Fun Facts
1. Jonnowales is three years into his four year degree course (graduated with a BSc, about to take an MSc) at the University of Quizdom (UoQ) and over the summer he has bagged himself a job with the UoQ's management information team; what a poor hiring decision! Jonnowales is a tidy enough chap but when things don't go his way, he can get a little bit petulant. Today is a good day for Jonno (new job and all), so on his first day he decides to do something benign with the table, named 'Papers', that lists every academic paper published by the establishment.
Which of the following pieces of SQL would allow Jonno to extract all the columns from the 'Papers' table?
Note: An asterisk can be used in SQL to represent all available columns.
2. Upon extracting all columns (and all rows) from the 'Papers' table in the university database, Jonno decides that he is only really interested in geography papers. Luckily for Jonno, the subject of a paper is captured and the data is stored in a column in the 'Papers' table called 'Category'. The 'Category' field is then populated, for every entry, with the name of the paper's subject.
Which of the following statements is the only one that would successfully extract just the geography papers from the 'Papers' table?
3. Jonno has copied all of the university's geography papers into a new table called 'GeoPapers' but he discovers that there is no real order to the papers; it is all a bit random! He would very much like to see what papers have been cited most frequently and spots a useful column called 'Citations' which provides the number of citations for each paper.
Which of the following pieces of SQL would allow Jonno to sort the papers by number of citations (lowest to highest)?
4. Different database systems require the use of different syntax for some SQL clauses (which can be a nuisance!). Jonno is a fan of Oracle and he uses this particular database management system (DBMS) to find geography papers in the top 1000 of all papers published by his university by citation count. Inspecting a table called 'GeoPapers', he sees a column named 'PaperTitle' (which contains the name of each paper) and decides this may be useful. It looks as though the 'CiteRank' column will be of use as it provides a University of Quizdom ranking to every paper published by the institution based on number of times it has been cited. The most cited paper will have the top 'CiteRank' value of one. Using all of this information he puts the following code together:
SELECT PaperTitle, CiteRank FROM GeoPapers WHERE CiteRank != 1000;
Will this statement provide Jonno with all the geography papers that rank in the university's top 1000 papers by number of citations?
5. Jonnowales is intrigued to find out how many University of Quizdom (UoQ) papers are associated with a "high quality" marker, a marker given if the paper is made up of content that has been well received nationally. In order to do that he checks out the 'Papers' table (which lists all UoQ papers) and focuses on the column called 'Quality'. The 'Quality' column is populated with a 'Yes' if the paper has been well received enough to earn "high quality" status, otherwise it is a 'No'.
Which of the following pieces of SQL would inform Jonnowales of the number of papers that have the much-desired "high quality" marker?
6. Jonnowales would really like to be able to author a paper that is good enough to reach number one in the university's citation rankings table. In order to get some inspiration he searches through the 'Paper' table (which lists all the university's papers) to find the current number one paper. Given the large number of rows in this table he decides to write some SQL so the searching job is done for him! He is particularly interested in a column called 'CiteRank' which gives the rank of every paper published by the University of Quizdom (UoQ) by number of citations.
Which of the following SQL statements would return ALL the details stored in the 'Papers' table (including the name of the paper stored in the column called 'PaperTitle') about the highest ranking UoQ paper?
Note: Keep in mind that the most cited UoQ paper would be stored in 'CiteRank' as 1.
7. Jonnowales wishes to feature more prominently in the 'Papers' table that contains the details of every paper published by the University of Quizdom. He gets to work and, in his spare time, authors a very tedious paper based on tiny villages in Irkutsk Oblast, a paper he thinks is, without a doubt, the best, most accessible academic geography paper ever written (he also thought his BSc Geography paper was world class)! He thought it was easily worth the "Internationally Significant" designation but the mean-spirited peer review panel thought otherwise. The paper was published in the famous "GeoJournal" but didn't get the recognition it clearly deserved. As Jonnowales has often been told, if you want something done then do it yourself!
Jonnowales quickly spots the column named 'IS' which is populated with a 'Yes' if a paper is believed to be "Internationally Significant" and with a 'No' if, like Jonno's fantastic Irkutsk paper, it hasn't been so lucky. Jonno decides to use his privileges to change the 'No' associated with his paper to a 'Yes', and in so doing gets his paper a prominent link on the home research page of the university's website! Which of these clauses would be the most useful in allowing him to get up to this sort of mischief?
8. Needless to say that the University of Quizdom's President wasn't impressed when he found out Jonnowales had awarded his mediocre paper "Internationally Significant" status through using SQL! It should also go without saying that the President has the IT team remove the "thumb". Jonnowales decided to have a tantrum about this and said to himself, "if I can't be internationally significant, then NOBODY can be"! Jonnowales put together a piece of SQL which uses the 'Papers' table (which contains the details of all the university's papers) and the column labeled 'IS'. The 'IS' column is populated with 'Yes' if a paper has been designated "Internationally Significant" and 'No' if it hasn't. The code is as follows:
DELETE FROM Papers WHERE IS = 'Yes';
What has Jonnowales done?
9. The university's President found out all about Jonnowales' SQL exploits and decided that enough was enough! His first step was to get IT to restore the 'Papers' table back to the state it was in before Jonnowales messed it up. They did this by simply retrieving a view of the main table that is created daily! Jonnowales was flabbergasted that he had been so easily outsmarted and asked Bob from IT what SQL he used to create a backup copy of the 'Papers' table. Bob was gracious enough to tell him the answer.
Which of the following clauses would Bob have used to create a backup copy of a table?
10. Once Bob had put right what Jonnowales had messed up, the university's President decided that Jonno was too much of a menace to keep around. So, he got Bob to check the 'Degree' table (which contains details of all degrees awarded by the University of Quizdom) so as to find the column that can be used to revoke a graduate's degree! The column happens to be called 'Revoke'. Switching the value of this column, for a specified graduate, from 'No' to 'Yes' would result in the specified graduate no longer being recorded as having a degree awarded by the institution (Jonno personally thinks this is a bit of overreaction). The name of the university graduate is stored in a column named 'Graduate'.
Which of the following pieces of SQL would revoke Jonnowales' BSc?
Source: Author
jonnowales
This quiz was reviewed by FunTrivia editor
WesleyCrusher before going online.
Any errors found in FunTrivia content are routinely corrected through our feedback system.