Supervision 2 Questions

  1. On our 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

       select person_id, movie_id, position from credits
       where position <> 17;
    

    Explain your answer.

  2. Suppose that a and b are 3-valued expressions in SQL (true, false, or null). Can the expression (a and b) is null be rewritten as an equivalent boolean combination of a, b, a is null, and b is null?

  3. In boolean logic, the expressin not(a and b) always has the same value as (not a) or (not b). 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. (Difficult?) The URL '<https://datasets.imdbws.com/>' contains the raw data from which I have extracted our database instance. I've done this with scripts build_IMDb_raw.py and build_IMDb_relational.py that you can find at '<https://github.com/Timothy-G-Griffin/build_databases.cst.cam.ac.uk>'. In particular, I have used the IMDb table title.principals.tsv to generate tables positions and roles. In fact, I did not do a very good job of reverse-engineering and modeling the data from title.principals.tsv. Can you do a better job? See what I did starting on line 279 of build_IMDb_relational.py. (What a mess!) In my defense, the last time I looked closely at title.principals.tsv it was full of errors and inconsistencies. Perhaps they have been fixed by now.