Which of the following statements is correct? If we have a many-to-one relations
ID: 3720457 • Letter: W
Question
Which of the following statements is correct?
If we have a many-to-one relationship set R connecting two entity sets E1 and E2 in an E-R diagram, we may simply convert R, E1, and E2 into two relations.
A weak entity set in E-R diagrams must have an attribute in it to uniquely identify each entity.
When converting a many-to-many relationship set in an E-R diagram to a relation, it should always have a foreign key.
When designing E-R diagrams, we should consider what indexes to build.
2 Consider the following simplified friends relational schema
person (name, address);
friends (name1, name2);
where the second relation stores the information about friends (ie., name1 and name2 are friends). Assume that this is symmetric relationship, and if X and Y are friends, then the second relation contains two tuples (X, Y), and (Y, X).
Now consider this query:
select name
from person p
where exists (select *
from friends r, person p2
where r.name1 = p.name and p2.name = r.name2 and p.address = p2.address)
Which of the following queries gives the same result as the above query?
select distinct name
from person p, friends r, person p2
where r.name1 = p.name and p2.name = r.name2 and p.address = p2.address
select distinct name
from person p
where p.name in (select p2.name
from person p2, friends r
where r.name2 = p2.name and r.name1 = p.name and p.address = p2.address)
select distinct name
from person p
where p.address = (select p2.address
from person p2, friends r
where r.name2 = p2.name and r.name1 = p.name)
select distinct name
from person p
where not unique (select *
from person p2, friends r
where r.name2 = p2.name and r.name1 = p.name and p.address = p2.address)
If we have a many-to-one relationship set R connecting two entity sets E1 and E2 in an E-R diagram, we may simply convert R, E1, and E2 into two relations.
A weak entity set in E-R diagrams must have an attribute in it to uniquely identify each entity.
When converting a many-to-many relationship set in an E-R diagram to a relation, it should always have a foreign key.
When designing E-R diagrams, we should consider what indexes to build.
Explanation / Answer
all the queries give the same result as stated above.
it simply means that output a name from table person say p such that there exists a name r in friends same as p. and address of friend of r is same as adress of p.
all four queries are stating the same.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.