Question

The following relational schema is given for a Pokemon Database: Pokemon (PID, PName) Type (TID, TName)...

The following relational schema is given for a Pokemon Database:

Pokemon (PID, PName)

Type (TID, TName)

Trainer (SSN, Name, Surname)

InType (PID, TID)

StrongAgainst (TID_Strong, TID_Weak)

Owns (SSN, PID, Nickname, Level, Height, Weight, Catch_Date)

SpecializedIn (SSN, TID)

In this database, Pokemon (Imaginary creatures, short for “Pocket Monsters”) are stored in the entity set Pokemon, with a unique PID and PName. Pokemon types are stored in the entity set Type, with a unique TID and TName. Pokemon trainers are stored in the entity set Trainer, including a unique SSN, Name and Surname for each trainer.

Relation InType is used for matching Pokemon with types. One Pokemon could be in many types, and there could be many Pokemon of a type. Each Pokemon should have at least one type. In this relation, PID is a foreign key to Pokemon entity set and TID is a foreign key to the Type entity set. Some types of Pokemon are strong against other types, relation StrongAgainst is used for indicating which type is strong against which other type. Both TID_Strong and TID_Weak are foreign keys to the entity set Type, TID_Strong being strong against TID_Weak. This is a many-to-many relation. Not every type is strong against some other type.

Relation Owns is used when a trainer owns a certain Pokemon. SSN is a foreign key to the Trainer entity set and PID is a foreign key to the Pokemon entity set. SSN, PID and Nickname contribute to the primary key of this table. (In Pokemon table we store different kinds of existing Pokemon, and when an instance of a specific kind is owned by a trainer, we store it using the relation Owns. For example, one trainer could own multiple instances of the same kind of Pokemon, with different Nicknames given to each instance). Level is a number that indicates the experience, hence the power of the Pokemon (Higher is stronger). Height is a number in centimeters, and Weight is a number in grams. Catch_Date indicates the start date of the partnership between a Pokemon and its trainer.

Some trainers are specialized in a certain type of Pokemon. A trainer could specialize in at most one type, and there could be many trainers specialized in a certain type. Relation SpecializedIn is used for this. SSN is a foreign key to the entity set Trainer, and TID is a foreign key to the entity set Type. SSN is the primary key of this table.

Questions are on the second page. 2

1) Draw the corresponding ER diagram, using Draw.IO. (10 points)

2) In the table SpecializedIn, only one of the foreign keys is used as a primary key; whereas in a different table such as InType, both foreign keys contribute to the primary key. What is the reason that there is only one primary key for the table SpecializedIn? Explain. (5 point)

Write the corresponding Relational Algebra expression for the remaining questions:

3) Find PName of Pokemon that are in type “Fire”. (5 points)

4) Find SSN and surname of the trainers whose name is “Gary”. (5 points)

5) Find type names that are weak against the type “Electricity”. (5 points)

6) Find name and surname of the trainers that does not own any Pokemon. (10 points)

7) Find PName and type (TName) of the Pokemon that are owned by the trainer whose name is “Drizzt” or “Bruenor”. (10 points)

8) Find name and surname of the trainers that own at least one Pokemon of each existing type. (There should be at least one Pokemon from each type that is owned by such trainers; for example, at least one “Fire”, at least one “Water”, and so on; for every type). (10 points)

9) Find SSN of the trainers that do not own any Pokemon of the type this trainer is specialized in. (Such trainers are specialized in a certain type, but they do not own any Pokemon that is in that certain type.) (10 points)

10) Find the heaviest Pokemon’s nickname that is owned by a trainer. (10 points)

11) Find name, weight and height of the Pokemon that was caught most recently, owned by the trainer with SSN “1837837”. (10 points)

12) Find name and level of the Pokemon that are owned by trainers that are specialized in a type that is strong against “Rock” or “Water”. (10 points)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

NOTE: According to HomeworkLib guidelines, it is required to solve only four sub parts, if there are multiple sub parts in same question. Please ask rest of the sub parts in another section.

Add a comment
Know the answer?
Add Answer to:
The following relational schema is given for a Pokemon Database: Pokemon (PID, PName) Type (TID, TName)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Can you write below relations like these (with symbols)? (∏ PName (σ TName = ‘Fire’ (Pokemon...

    Can you write below relations like these (with symbols)? (∏ PName (σ TName = ‘Fire’ (Pokemon X Type))), (∏ SSN, Surname(σ Name = ‘Gary’ (Trainer))) 3)Select PName from Pokémon inner join InType on Pokémon.PID = InType.PID inner join Type on Type.TID = InType.TID where TName = 'Fire'; 4)Select SSN, Surname from Trainer where name = 'Gary'; 5)Select TName from Type inner join StrongAgainst on Type.TID = StringAgainst.TID_String where TID_Weak = 'Electricity'; 6)Select Name, Surname from Trainer, Owns, Pokemon where Trainer.SSN...

  • Consider the following database Relation Schemas: Relation Schemas: Suppliers(SID CHAR(5), Parts(pID VARCHAR(5), type VARCHAR(15), pName VARCHAR(35),...

    Consider the following database Relation Schemas: Relation Schemas: Suppliers(SID CHAR(5), Parts(pID VARCHAR(5), type VARCHAR(15), pName VARCHAR(35), sName VARCHAR(15), address VARCHAR(30, city VARCHAR(20), state CHAR(2), PRIMARY KEY(sID); PRIMARY KEY(pID) Catalog(sID CHAR(5), pID VARCHAR(5), ty SMALLINT, cost FLOAT (10,2), PRIMARY KEY(sid, pid), FOREIGN KEY(sid) REFERENCES Suppliers(SID), FOREIGN KEY (pid) REFERENCES Parts pID) The meaning of these relations is straightforward; for example, the Catalog relation lists the prices charged for parts by Suppliers. Instances of the relations Suppliers sName address SID cit state...

  • Consider the following schema: SUPPLIERS (SID: integer, SNAME: string, STREET: string, CITY: string, ZIP: string) PARTS...

    Consider the following schema: SUPPLIERS (SID: integer, SNAME: string, STREET: string, CITY: string, ZIP: string) PARTS (PID: integer, PNAME: string, COLOR: string) CATALOG (SID: integer, PID: integer, COST: real) The primary key attributes are underlined, and the domain of each attribute is listed after the attribute name. Thus, SID is the primary key for SUPPLIERS, PID is the primary key for PARTS, and SID and PID together form the primary key for CATALOG. Attribute SID in CATALOG is a foreign...

  • Part I. Mapping an (E)ER schema to a relational database schema (46 points) NOTE o Each...

    Part I. Mapping an (E)ER schema to a relational database schema (46 points) NOTE o Each relation sachem should have a primary key (PK) when you answer. • To present the reference table of the foreign key (e.g., FK, FK1, K2), use an arrow. Do not use the relationship cardinality symbols of crow's foot notation in the relational database schema. o It is not required to specify the domain constraint (e.g., data type and length) of each attribute. 1. (12...

  • Consider the following relational schemas: Employee (eid: integer, ename: string, Job_title: string, Years_of_experience: integer) Project (pid:...

    Consider the following relational schemas: Employee (eid: integer, ename: string, Job_title: string, Years_of_experience: integer) Project (pid: integer, pname: string, parea: string, mid: integer, budget: integer) Works_on (eid: integer, pid: integer) Manger (mid: integer, mname: string, deptid: integer) The meaning of these relations is straightforward; for example, Works_on has one record per Employee-Project pair such that the Employee Works_on the Project. 1. Write the SQL statements required to create these relations, including appropriate versions of all primary and foreign key integrity...

  • Given the following relational database schema (primary keys are bold and underlined). Answer questions 2.1 to 2.4 Orde...

    Given the following relational database schema (primary keys are bold and underlined). Answer questions 2.1 to 2.4 Orders(orderld, customerld, dateOrdered, dateRequired, status) Customer(customerld, customerLastName, customerStreet, customerCity, customerState, customer Lip OrderDetails(orderld.productld, quantity, lineNumber, amount) Products(productld, name, description, quantity, unitPrice) Account(accountNumber, customerld, dateOpened, creditCard, mailingStreet, mailingCity, mailingState, mailingZip) 2.1 (2 Points) List all possible foreign keys. For each foreign key list both the referencing and referenced relations. 2.2 (2 Points) Devise a reasonable database instance by filling the tables with data of...

  • The following are the main entity types of the academic institution database. For each entity type,...

    The following are the main entity types of the academic institution database. For each entity type, we provide some of the corresponding attributes. Use this information in order to: (a) Build an Enhanced E-R diagram; (b) Transform the Enhanced E-R diagram to a relational database. Identify the primary key(s) and the foreign key(s) for each relation. Draw the relational integrality constraints; (c) For each of the relations created, indicate its normal form. If the relation is not in the 3NF,...

  • Consider the following relational database to manage concert and ticket sales. The relations are artist, concert,...

    Consider the following relational database to manage concert and ticket sales. The relations are artist, concert, venue, seat, ticket, and fan. The schemas for these relations (with primary key attributes underlined) are: Artist-schema = (artistname, type, salary) Concert-schema = (artistname, date, venuename, artistfees) Venue-schema = (venuename, address, seating_capacity) Seat-schema=(venuename, row, seatnumber) Ticket-schema = (fanID, date, venuename, row, seatnumber) Fan-schema = (fanID, name, address, creditcardno) Where: • artistname is a unique name for the artist (because of trademark/copyright rules no two...

  • Question: Write one SQL statement for the following question: Return number of players whose rating is...

    Question: Write one SQL statement for the following question: Return number of players whose rating is over 1000. Background information: This is a chess tournament management database that stores information about chess players, tournaments, sections, registrations, and pairings. Each player has an ID, name, grade (0 to 12) and rating. Each tournament has a number of sections. Each player can register for a section of a tournament In each round of a tournament, players in the same section will be...

  • Intro to database systems question: Question2 (20 points, 5 points each) Consider the following relational schema as part of a university database Prof(sin, pname, o_ce, age, sex, specialty, dept did...

    Intro to database systems question: Question2 (20 points, 5 points each) Consider the following relational schema as part of a university database Prof(sin, pname, o_ce, age, sex, specialty, dept did) Dept(did, dname, budget, num majors, chair sin) Assume the following queries are the most common queries in the workload for this university and they are almost equivalent in frequency and importance Assume that both B+ trees and hashed indexes are supported by the DBMS and that both single and multiple-attribute...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT