+ All Categories
Home > Documents > 351 Problem Set 1

351 Problem Set 1

Date post: 03-Apr-2018
Category:
Upload: bede-maclaurin
View: 245 times
Download: 0 times
Share this document with a friend

of 11

Transcript
  • 7/28/2019 351 Problem Set 1

    1/11

    351 Problem Set 1

    Lecture Examples

    1. What is a Database, DBMS, DB?2. What is the difference between a file system and a DBMS? (6 points)

    3. Why use a DBMS? (10 reasons)

    4. Define the following: Data Model, Schema, Relational model of data

    5. Describe the Levels of Abstraction (6)

    6. Describe the Logical, Physical and External Schemas of a university Database.

    7. Describe Logical and Physical data independence.

    8. Concurrency describe advantages and risks.

    9. Who use databases?

    10. What is the Relational Model of Data?

    11. What does a tuple do? What does a Database do? What is a relation?

    12. What is an attribute? How does a tuple fit into a relation?

    13. A relation schema is a ------- --- -, the elements of which are called --------

    and where each --------- - - - is associated with a ------ ----.

    14. Given a relation schema R={A1, , An), define an R-tuple and an R-relation.

    15. Give a MOVIE-tuple for the relation schema MOVIE(title, director, country,

    year)

    16. Write t = (----------------) to show that v_i belongs to attribute A_i. Do this for

    the MOVIE-tuple.

    17. Define R-tuple as a function.

    18. A database schema is a ------ --- - of -------- --------19. Give a database schema of relation schemata MOVIE, PERSON, DIRECTOR,

    ACTOR

    20. A relational database over a database schema consists of a -------- for every

    -------- ------ that is a member of the -------- -------

    21. Let S a database schema. An S-database I consists of just one - -------- I(R) for

    each -------- ------ R in S. I = {--------}

    22. Give a database consisting of four relations (one for each of the relation

    schemata in the underlying database schema). How does this database relate to

    the previous question?

    23. Give the definition of super key and key

    24. Is title a good choice for a key over MOVIE?

    25. Over MOVIE(title, year, country, run-time, genre) give a reasonable super

    key, and key.

    26. Give a key over ACTOR(id, title, year, role)

    27. Give the definition of foreign key. Why are they useful?

    28. Give foreign keys on DIRECTOR(id, title, year)

    29. What is a common pitfall here?

    30. What are integrity constraints? What do they do?

  • 7/28/2019 351 Problem Set 1

    2/11

    31.

    Give some schema design choices (eg. S1 = {R1(..), Rn(..)})

    What does the choice depend on?

    32. Describe the syntactic and semantic levels of the relational data model.

    33. Describe the SQL table commands.

    34. Give 14 examples of domains. How are lengths of strings described?

    35. What is a null marker? Why are they used? What does X-total mean?

    36. What is a duplicate tuple? Can a relation have a duplicate tuple?

    37. SQL semantics. What is a Table Schema? Table? Partiality? Multi-set?

    38. Relations are idealised special cases of tables where: neither --------- -------

    nor ------- ------- are permitted to occur.39. What constraints can be added to a table? How are they defined?

    40. Given the following Relational Database Schema, define it using SQL

    41.

    42.

  • 7/28/2019 351 Problem Set 1

    3/11

    43. What are referential actions? Describe the four SQL referential actions.

    44. What happens if you delete a movie here?

    45. Define

    CREATE ASSERTION [name] CHECK

    CREATE DOMAIN

    CREATE VIEW [name] AS [query]

    CREATE GLOBAL TEMPORARY TABLE

    CREATE LOCAL TEMPORARY TABLE

    46. Describe each line of the following code

    47. Describe INSERT (3 ways), DELETE, UPDATE

    48. Draw the table at each stage

    49. Give the basic form for all queries. What does * signify? How may attribute

    names be qualified? How does one rename attribute and table names? How does

    SELECT DISTINCT relate to multisets? How is the result of a query ordered?

  • 7/28/2019 351 Problem Set 1

    4/11

    50. Give the SQL code

    51. Conditions in the WHERE clause. Describe simple and complex conditions,value lists (2 forms), testing for null values, pattern matching.

    52. Give the code

    53. Give five aggregate functions. Can one use more than one in a query? What is

    DISTINCT?

    54.

    55.

    56. Describe GROUP BY and HAVING.

    57.

    58.

    In what context are IN, EXISTS, UNIQUE, ALL, SOME, ANY, NOT used?

    59. Give the code

    60.

  • 7/28/2019 351 Problem Set 1

    5/11

    61. Show how the structure of a reachability query is rewritten as rules.

    62. Apply this process to the following example

    How is it written in SQL99?

    63. Show how reachability is described as a recursive rule-based query. How isthe above example then written in SQL99?

    64.

    65. Consider this rule:

    Give the SQL

    Let S be {1, 2} and evaluate

    Is there a problem? If so, what is the cause?

    Worksheets

  • 7/28/2019 351 Problem Set 1

    6/11

  • 7/28/2019 351 Problem Set 1

    7/11

    Tutorials

    Past Exams

  • 7/28/2019 351 Problem Set 1

    8/11

  • 7/28/2019 351 Problem Set 1

    9/11

  • 7/28/2019 351 Problem Set 1

    10/11

  • 7/28/2019 351 Problem Set 1

    11/11


Recommended