These are suggested questions that supervisors might want to use during supervisions.
Explain how SQL relates to multisets and when to use the DISTINCT keyword.
On the movie database, will the SQL query
select person_id, movie_id, position
from credits
where not((not (position is null)) or position = 17);
return the same results as the query
Explain your answer.
3a. What is the difference between an inner and an outer join? Note there are left and right variants.
Is that true in 3-valued logic?
What about the expression not(a or b) and the expression (not a) and (not b)?
Is the expression a or (not a) always true in 3-valued logic? If not, can you extend this axiom to make it always true?
4. The GROUP BY construct requires two functions: a first to partition the data into groups and a second to reduce the various values in a group into a single value (known as reduction of a vector to a scalar). Which of the following operations are generally suitable for use in each context: addition, subtraction, roughly-equal, cosine, maximum, count, equals-to, greater-than, not-equal-to, average, identity? For each function, mention its abstract properties (eg. commutative, has an inverse). (A recent Tripos question).
The graph database tutorial this year is the same as last year's and available here https://www.cl.cam.ac.uk/teaching/2324/Databases/djg-materials/graph-highlighted.html
Some versions of neo4j come with an example movie database, rather like the snapshot we've been using. We suggest you load our snapshot instead of using the default one. Have a play with it. Note that neither details of Neo4j or Cypher syntax will be asked about in Tripos questions.
To clarify further: the content of the relational tutorial is examinable, together with everything lectured in the 8 lectures. The content of the further two tutorials (document and graph), where it extends beyond what was lectured, is not examinable. The formal syllabus is on the course web page https://www.cl.cam.ac.uk/teaching/current/Databases/
Summarise the notion of 'closure' in terms of repeated function composition and fixed points. Give a real-world example of transitive closure.
Optional question: Explain why concepts of fixed points and closure are relevant to finding the results of recursive SQL queries. [Syntactic details of recursive SQL are not examinable.]
The following function is a least-fixed point finder coded in ML. Give a non-recursive ML function that that uses it to find the lowest natural number equal to or above the square root of argument S:
let lfp f = let rec search n = if f(n)=n then n else search (n+1) in search 1 end let int_sqroot S = ... your code that uses lfp ...
9. Neo4j edges have a unique identifier, a type and attributes. Write 3 example Neo4j queries that each illustrate looking up on each of these.
[Repeat: Neither details of Neo4J or Cypher syntax will be asked about in Tripos questions.] [NB. Experienced computerists will choke on the word 'type' above: they would be happier to say all edges have the same type and call this field a 'kind'.]
END. (C) TGG 2021 (C) 2022/25 DJG, University of Cambridge, Computer Laboratory.