SlideShare a Scribd company logo
1 of 2
Consider the following relations EMP (EID #: int, ENAME: char (50), ESALARY: real, DID:
int) DEP (DID #: int, DNAME: char (20), DLOCATION: char (30)) which are located at the
nodes T1, T2, respectively. Each integer (int) has size 4 bytes each actual (real) 8 bytes, and each
character (char) 1 byte. OR relation EMP has 5 entries with keys EID1 DID1, EID2 DID1, EID3
DID3, EID4 DID3, EID5 DID3. The relationship DEP has 6 entries with keys DID1 ATHENS,
DID2 ROME, DID3 ATHENS, DID4 PARIS, DID5 MUNICH, DID6 LONDON. Let's say that
transport costs are equal to the size of the transferred data. 1) Determine the optimal plan and the
execution cost Question EMP JOIN DLOCATION = "ATHENS" DEP to have the result at
junction T3. 2) Find the optimal plan and costs for executing the query EMP JOIN DEP to have
the result at node T3.
Solution
Assuming that your structure would be as follows presenting the query as below, It would be
better if you could mention your table structures a bit more clearly about the entries of
DEP.Here, Declare the two table EMP,DEP with there corresponding entries.
DECLARE @Emp TABLE(EID int, ENAME Varchar(50), ESALARY real, DID int )
DECLARE @Dep TABLE(DID int, DNAME Varchar(50), DLOCATION Varchar(30) )
INSERT INTO @Emp(EID, DID) VALUES ((EID1, DID1),(EID2, DID2), (EID3, DID3),
(EID4, DID3), (EID5, DID3))
INSERT INTO @Dep ((DID1, ATHENS), (DID2, ROME), (DID3, ATHENS), (DID4, PARIS),
(DID5, MUNICH), (DID6, LONDON))
SELECT * FROM @Emp
SELECT * FROM @Dep
/*
Query to print results as EMP, DLOCATION
*/
SELECT em.eid,e1.edid as DID,e2.edlocation as DLOCATION
FROM @DEP
JOIN @Emp e1 ON em.eid=e1.eid
JOIN @Emp e2 ON em.dloaction=e2.eid
above query explains the insertion of the EMP entries and afterwards DEP entries. JOIN
keyword merge/join the query which will be shoe the in the located node.

More Related Content

Similar to Consider the following relations EMP (EID #- int- ENAME- char (50)- ES.docx

Digital Signal Processing Lab Manual
Digital Signal Processing Lab Manual Digital Signal Processing Lab Manual
Digital Signal Processing Lab Manual Amairullah Khan Lodhi
 
Java: Introduction to Arrays
Java: Introduction to ArraysJava: Introduction to Arrays
Java: Introduction to ArraysTareq Hasan
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfaroraopticals15
 
08-09 Chapter numerical integration
08-09  Chapter numerical integration 08-09  Chapter numerical integration
08-09 Chapter numerical integration Dr. Mohammed Danish
 
Data Structure Midterm Lesson Arrays
Data Structure Midterm Lesson ArraysData Structure Midterm Lesson Arrays
Data Structure Midterm Lesson ArraysMaulen Bale
 
Arrays and library functions
Arrays and library functionsArrays and library functions
Arrays and library functionsSwarup Boro
 
3.ArraysandPointers.pptx
3.ArraysandPointers.pptx3.ArraysandPointers.pptx
3.ArraysandPointers.pptxFolkAdonis
 
Lecture 15_Strings and Dynamic Memory Allocation.pptx
Lecture 15_Strings and  Dynamic Memory Allocation.pptxLecture 15_Strings and  Dynamic Memory Allocation.pptx
Lecture 15_Strings and Dynamic Memory Allocation.pptxJawadTanvir
 
Huffman coding
Huffman codingHuffman coding
Huffman codingGeorge Ang
 
Intermediate code generation1
Intermediate code generation1Intermediate code generation1
Intermediate code generation1Shashwat Shriparv
 
Perl.predefined.variables
Perl.predefined.variablesPerl.predefined.variables
Perl.predefined.variablesKing Hom
 

Similar to Consider the following relations EMP (EID #- int- ENAME- char (50)- ES.docx (20)

Digital Signal Processing Lab Manual
Digital Signal Processing Lab Manual Digital Signal Processing Lab Manual
Digital Signal Processing Lab Manual
 
Java: Introduction to Arrays
Java: Introduction to ArraysJava: Introduction to Arrays
Java: Introduction to Arrays
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdf
 
08-09 Chapter numerical integration
08-09  Chapter numerical integration 08-09  Chapter numerical integration
08-09 Chapter numerical integration
 
Data Structure Midterm Lesson Arrays
Data Structure Midterm Lesson ArraysData Structure Midterm Lesson Arrays
Data Structure Midterm Lesson Arrays
 
Co&al lecture-08
Co&al lecture-08Co&al lecture-08
Co&al lecture-08
 
ARRAYS
ARRAYSARRAYS
ARRAYS
 
Scala Paradigms
Scala ParadigmsScala Paradigms
Scala Paradigms
 
Embedded C - Lecture 2
Embedded C - Lecture 2Embedded C - Lecture 2
Embedded C - Lecture 2
 
C_Arrays.pptx
C_Arrays.pptxC_Arrays.pptx
C_Arrays.pptx
 
Unit 2
Unit 2Unit 2
Unit 2
 
Arrays and library functions
Arrays and library functionsArrays and library functions
Arrays and library functions
 
Functions
FunctionsFunctions
Functions
 
3.ArraysandPointers.pptx
3.ArraysandPointers.pptx3.ArraysandPointers.pptx
3.ArraysandPointers.pptx
 
Huffman Coding
Huffman CodingHuffman Coding
Huffman Coding
 
Array
ArrayArray
Array
 
Lecture 15_Strings and Dynamic Memory Allocation.pptx
Lecture 15_Strings and  Dynamic Memory Allocation.pptxLecture 15_Strings and  Dynamic Memory Allocation.pptx
Lecture 15_Strings and Dynamic Memory Allocation.pptx
 
Huffman coding
Huffman codingHuffman coding
Huffman coding
 
Intermediate code generation1
Intermediate code generation1Intermediate code generation1
Intermediate code generation1
 
Perl.predefined.variables
Perl.predefined.variablesPerl.predefined.variables
Perl.predefined.variables
 

More from kaseya1

A number of monks live in a monastery and they do not communicate in a.docx
A number of monks live in a monastery and they do not communicate in a.docxA number of monks live in a monastery and they do not communicate in a.docx
A number of monks live in a monastery and they do not communicate in a.docxkaseya1
 
A molecule or ion that donates the hydrogen in a hydrogen bond is a hy (1).docx
A molecule or ion that donates the hydrogen in a hydrogen bond is a hy (1).docxA molecule or ion that donates the hydrogen in a hydrogen bond is a hy (1).docx
A molecule or ion that donates the hydrogen in a hydrogen bond is a hy (1).docxkaseya1
 
A person talking produces a sound level of 65 dB at a distance of 50 c.docx
A person talking produces a sound level of 65 dB at a distance of 50 c.docxA person talking produces a sound level of 65 dB at a distance of 50 c.docx
A person talking produces a sound level of 65 dB at a distance of 50 c.docxkaseya1
 
A metal plate is illuminated with light of a certain frequency- Which.docx
A metal plate is illuminated with light of a certain frequency- Which.docxA metal plate is illuminated with light of a certain frequency- Which.docx
A metal plate is illuminated with light of a certain frequency- Which.docxkaseya1
 
A Martian leaves Mars in a spaceship that is heading to Venus- On the.docx
A Martian leaves Mars in a spaceship that is heading to Venus- On the.docxA Martian leaves Mars in a spaceship that is heading to Venus- On the.docx
A Martian leaves Mars in a spaceship that is heading to Venus- On the.docxkaseya1
 
a major change in our study of differing economic systems in the era o.docx
a major change in our study of differing economic systems in the era o.docxa major change in our study of differing economic systems in the era o.docx
a major change in our study of differing economic systems in the era o.docxkaseya1
 
A leadership-motivation case is provided below- The case includes impo.docx
A leadership-motivation case is provided below- The case includes impo.docxA leadership-motivation case is provided below- The case includes impo.docx
A leadership-motivation case is provided below- The case includes impo.docxkaseya1
 
A kettle is filled with tap water and placed on a stove- The stove ele.docx
A kettle is filled with tap water and placed on a stove- The stove ele.docxA kettle is filled with tap water and placed on a stove- The stove ele.docx
A kettle is filled with tap water and placed on a stove- The stove ele.docxkaseya1
 
A photographer works part-time in a shopping center- 2 hours per day-.docx
A photographer works part-time in a shopping center- 2 hours per day-.docxA photographer works part-time in a shopping center- 2 hours per day-.docx
A photographer works part-time in a shopping center- 2 hours per day-.docxkaseya1
 
Consider the following definitions for linked lists for problems 6 thr.docx
Consider the following definitions for linked lists for problems 6 thr.docxConsider the following definitions for linked lists for problems 6 thr.docx
Consider the following definitions for linked lists for problems 6 thr.docxkaseya1
 
Consider the following chemical compounds- Classify each as either an.docx
Consider the following chemical compounds- Classify each as either an.docxConsider the following chemical compounds- Classify each as either an.docx
Consider the following chemical compounds- Classify each as either an.docxkaseya1
 
Consider the plane R2 and consider any two lines that pass through the.docx
Consider the plane R2 and consider any two lines that pass through the.docxConsider the plane R2 and consider any two lines that pass through the.docx
Consider the plane R2 and consider any two lines that pass through the.docxkaseya1
 
Consider the following statements about the investment in working capi.docx
Consider the following statements about the investment in working capi.docxConsider the following statements about the investment in working capi.docx
Consider the following statements about the investment in working capi.docxkaseya1
 
Consider the following method definitions intended to find the smalles.docx
Consider the following method definitions intended to find the smalles.docxConsider the following method definitions intended to find the smalles.docx
Consider the following method definitions intended to find the smalles.docxkaseya1
 
Consider relations R and S as following and answer question- R A B 1 2 (8).docx
Consider relations R and S as following and answer question- R A B 1 2 (8).docxConsider relations R and S as following and answer question- R A B 1 2 (8).docx
Consider relations R and S as following and answer question- R A B 1 2 (8).docxkaseya1
 

More from kaseya1 (15)

A number of monks live in a monastery and they do not communicate in a.docx
A number of monks live in a monastery and they do not communicate in a.docxA number of monks live in a monastery and they do not communicate in a.docx
A number of monks live in a monastery and they do not communicate in a.docx
 
A molecule or ion that donates the hydrogen in a hydrogen bond is a hy (1).docx
A molecule or ion that donates the hydrogen in a hydrogen bond is a hy (1).docxA molecule or ion that donates the hydrogen in a hydrogen bond is a hy (1).docx
A molecule or ion that donates the hydrogen in a hydrogen bond is a hy (1).docx
 
A person talking produces a sound level of 65 dB at a distance of 50 c.docx
A person talking produces a sound level of 65 dB at a distance of 50 c.docxA person talking produces a sound level of 65 dB at a distance of 50 c.docx
A person talking produces a sound level of 65 dB at a distance of 50 c.docx
 
A metal plate is illuminated with light of a certain frequency- Which.docx
A metal plate is illuminated with light of a certain frequency- Which.docxA metal plate is illuminated with light of a certain frequency- Which.docx
A metal plate is illuminated with light of a certain frequency- Which.docx
 
A Martian leaves Mars in a spaceship that is heading to Venus- On the.docx
A Martian leaves Mars in a spaceship that is heading to Venus- On the.docxA Martian leaves Mars in a spaceship that is heading to Venus- On the.docx
A Martian leaves Mars in a spaceship that is heading to Venus- On the.docx
 
a major change in our study of differing economic systems in the era o.docx
a major change in our study of differing economic systems in the era o.docxa major change in our study of differing economic systems in the era o.docx
a major change in our study of differing economic systems in the era o.docx
 
A leadership-motivation case is provided below- The case includes impo.docx
A leadership-motivation case is provided below- The case includes impo.docxA leadership-motivation case is provided below- The case includes impo.docx
A leadership-motivation case is provided below- The case includes impo.docx
 
A kettle is filled with tap water and placed on a stove- The stove ele.docx
A kettle is filled with tap water and placed on a stove- The stove ele.docxA kettle is filled with tap water and placed on a stove- The stove ele.docx
A kettle is filled with tap water and placed on a stove- The stove ele.docx
 
A photographer works part-time in a shopping center- 2 hours per day-.docx
A photographer works part-time in a shopping center- 2 hours per day-.docxA photographer works part-time in a shopping center- 2 hours per day-.docx
A photographer works part-time in a shopping center- 2 hours per day-.docx
 
Consider the following definitions for linked lists for problems 6 thr.docx
Consider the following definitions for linked lists for problems 6 thr.docxConsider the following definitions for linked lists for problems 6 thr.docx
Consider the following definitions for linked lists for problems 6 thr.docx
 
Consider the following chemical compounds- Classify each as either an.docx
Consider the following chemical compounds- Classify each as either an.docxConsider the following chemical compounds- Classify each as either an.docx
Consider the following chemical compounds- Classify each as either an.docx
 
Consider the plane R2 and consider any two lines that pass through the.docx
Consider the plane R2 and consider any two lines that pass through the.docxConsider the plane R2 and consider any two lines that pass through the.docx
Consider the plane R2 and consider any two lines that pass through the.docx
 
Consider the following statements about the investment in working capi.docx
Consider the following statements about the investment in working capi.docxConsider the following statements about the investment in working capi.docx
Consider the following statements about the investment in working capi.docx
 
Consider the following method definitions intended to find the smalles.docx
Consider the following method definitions intended to find the smalles.docxConsider the following method definitions intended to find the smalles.docx
Consider the following method definitions intended to find the smalles.docx
 
Consider relations R and S as following and answer question- R A B 1 2 (8).docx
Consider relations R and S as following and answer question- R A B 1 2 (8).docxConsider relations R and S as following and answer question- R A B 1 2 (8).docx
Consider relations R and S as following and answer question- R A B 1 2 (8).docx
 

Recently uploaded

How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 

Recently uploaded (20)

How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 

Consider the following relations EMP (EID #- int- ENAME- char (50)- ES.docx

  • 1. Consider the following relations EMP (EID #: int, ENAME: char (50), ESALARY: real, DID: int) DEP (DID #: int, DNAME: char (20), DLOCATION: char (30)) which are located at the nodes T1, T2, respectively. Each integer (int) has size 4 bytes each actual (real) 8 bytes, and each character (char) 1 byte. OR relation EMP has 5 entries with keys EID1 DID1, EID2 DID1, EID3 DID3, EID4 DID3, EID5 DID3. The relationship DEP has 6 entries with keys DID1 ATHENS, DID2 ROME, DID3 ATHENS, DID4 PARIS, DID5 MUNICH, DID6 LONDON. Let's say that transport costs are equal to the size of the transferred data. 1) Determine the optimal plan and the execution cost Question EMP JOIN DLOCATION = "ATHENS" DEP to have the result at junction T3. 2) Find the optimal plan and costs for executing the query EMP JOIN DEP to have the result at node T3. Solution Assuming that your structure would be as follows presenting the query as below, It would be better if you could mention your table structures a bit more clearly about the entries of DEP.Here, Declare the two table EMP,DEP with there corresponding entries. DECLARE @Emp TABLE(EID int, ENAME Varchar(50), ESALARY real, DID int ) DECLARE @Dep TABLE(DID int, DNAME Varchar(50), DLOCATION Varchar(30) ) INSERT INTO @Emp(EID, DID) VALUES ((EID1, DID1),(EID2, DID2), (EID3, DID3), (EID4, DID3), (EID5, DID3)) INSERT INTO @Dep ((DID1, ATHENS), (DID2, ROME), (DID3, ATHENS), (DID4, PARIS), (DID5, MUNICH), (DID6, LONDON)) SELECT * FROM @Emp SELECT * FROM @Dep /* Query to print results as EMP, DLOCATION */
  • 2. SELECT em.eid,e1.edid as DID,e2.edlocation as DLOCATION FROM @DEP JOIN @Emp e1 ON em.eid=e1.eid JOIN @Emp e2 ON em.dloaction=e2.eid above query explains the insertion of the EMP entries and afterwards DEP entries. JOIN keyword merge/join the query which will be shoe the in the located node.