Información

Autor(es) Quentin Cappart
Fecha de entrega Sin fecha de envío
Tiempo límite de envío Sin límite de envío

Inicia sesión

Jointure naturelle

Cette question va vous introduire à la notion de jointure naturelle qui permet de faire une jointure dont les attributs à joindre sont évidents. Une description est disponible dans l'ouvrage de référence (chapitre 2).

jointure naturelle (\(\bowtie\))

La jointure naturelle est une opération binaire entre deux relations \(R\) et \(S\). Elle combine en une fois :

  1. Un produit cartésien implicite entre \(R\) et \(S\).
  2. Une sélection sur les attributs portant le même nom.
  3. L’élimination des attributs dupliqués.

Formellement, si \(R\) et \(S\) partagent les attributs \(A_1,\dots,A_k\), alors:

  • \(R \bowtie S = \pi_{attr(R)\cup attr(S)} \left(\sigma_{R.A_1=S.A_1 \land \dots \land R.A_k=S.A_k}(R \times S)\right)\)

Intuitivement, il s'agit d'une jointure qui se fait sur base des attributs communs aux deux relations. Prenons par exemple les relations:

  • \(\mathsf{department}(\underline{dept\_name}, building, budget)\)
  • \(\mathsf{student}(\underline{ID}, name, dept\_name, tot\_credit)\)

La jointure naturelle \(student \bowtie department\) associe chaque étudiant au département dont le \(dept\_name\) correspond, et supprime la duplication de l’attribut \(dept\_name\).

Question

Considérez les 3 relations suivantes venant de la base de données university.

Table: instructor
ID name dept_name salary
10101 Srinivasan Comp. Sci. 65000
12121 Wu Finance 90000
15151 Mozart Music 40000
22222 Einstein Physics 95000
32343 El Said History 60000
33456 Gold Physics 87000
45565 Katz Comp. Sci. 75000
58583 Califieri History 62000
76543 Singh Finance 80000
76766 Crick Biology 72000
83821 Brandt Comp. Sci. 92000
98345 Kim Elec. Eng. 80000
Table: department
dept_name building budget
Biology Watson 90000
Comp. Sci. Taylor 100000
Elec. Eng. Taylor 85000
Finance Painter 120000
History Painter 50000
Music Packard 80000
Physics Watson 70000
Table: student
ID name dept_name tot_cred
00128 Zhang Comp. Sci. 102
12345 Shankar Comp. Sci. 32
19991 Brandt History 80
23121 Chavez Finance 110
44553 Peltier Physics 56
45678 Levy Physics 46
54321 Williams Comp. Sci. 54
55739 Sanchez Music 38
70557 Snow Physics 0
76543 Brown Comp. Sci. 58
76653 Aoi Elec. Eng. 60
98765 Bourikas Elec. Eng. 98
98988 Tanaka Biology 120

Pregunta 1:

\(|instructor \bowtie department|\)

Pregunta 2:

Nombre d’attributs de \(instructor \bowtie department\)

Pregunta 3:

\(\pi_{building}(instructor \bowtie department)\) contient :

Pregunta 4:

\(|student \bowtie department|\)

Pregunta 5:

Nombre d’attributs de \(student \bowtie department\)

Pregunta 6:

\(|instructor \bowtie student|\)

Pregunta 7:

Nombre d’attributs de \(instructor \bowtie student\)

Pregunta 8:

\(\pi_{dept\_name}(instructor \bowtie department)\) contient :

Pregunta 9:

\(|\pi_{building}(instructor \bowtie department)|\)

Pregunta 10:

\(\pi_{name}(student \bowtie department)\) contient :