168360 Database Systems Semester I/2547 Page 1/1

168360 Database Systems Semester I/2547 Page 1/1

<p>168360 Database Systems Semester I/2547 Page 1/1</p><p>Exercise 3 Given: June 25, 2004, Submitted: June 28, 2004</p><p>Maximum number of points possible: 20. This exercise counts for 1% of your overall grade. 1. Define the following terms: relational schema, relational database schema, domain, attribute, attribute domain, relation instance, relation cardinality, and relation degree (8 points)</p><p>2. Does the relational model, as seen by an SQL query writer, provide physical and logical data independence? Explain (2 points)</p><p>3. What is the difference between a candidate key and the primary key for a given relation? What is a superkey? Consider the instance of Students relation shown below, identify a set of attributes that are considered as “a candidate key” and a set of attributes that are considered as “a superkey” (4 points)</p><p>4. Answer each of the following questions briefly. The questions are based on the following relational schema:</p><p>Emp(eid: integer, ename: string, age: integer, salary:real) Works(eid:integer, did:integer, pcttime:integer) Dept(did:integer, dname:string, budget:real, managerid:integer)</p><p>4.1 Give an example of a foreign key constraint that involves the Dept relation. What are the options for enforcing this constraint when a user attempt to delete a Dept tuple? (1 point)</p><p>4.2 Write the SQL statements required to create the preceding relations, including appropriate versions of all primary and foreign key integrity constraints. Note that for a foreign key constraint of relation ‘Works’, we would like to delete all Works tuples that refer to the department or the employee if that department or that employee is deleted. In the ‘Dept’ relation, if an employee who is a manager resigns (deleted), we want to say that we will assign a manager for that department soon but this information is not currently applicable (set the value to null) (1 point)</p><p>4.3 Define the Dept relation in SQL so that every department is guaranteed to have a manager (1 point)</p><p>4.4 Write an SQL statement to add John Doe as an employee with eid = 101, age = 32 and salary = 15,000 (1 point)</p><p>4.5 Write an SQL statement to give every employee a 10 percent raise (1 point)</p><p>4.6 Write an SQL statement to delete the Toy department (dname = ‘Toy’). Given the referential integrity constraint in the schema, explain what happens when this statement is executed (1 point)</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    1 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us