Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a compilable Java program with the following parameters. Problem: Relation

ID: 649070 • Letter: W

Question

Write a compilable Java program with the following parameters. Problem: Relational Algebra Let's suppose we have four tables called T1 and T2 We can perform what is known as basic relational algbra operations on these tables as demonstrated below. The ID column from one table is used to match one row against the row from the other table. Union: the union of T1 and T2 results in all the records/tuples from both tables with no duplicates. Intersection: the intersection of T1 and T2 results in all the records/tuples from both tables that are the same. Difference: the difference of T1 and T2 results in all records in T1 that are not in T2. Join: The join of T1 and T2 result in all records/tuples from both tables if there is a match on the given key. The so called basic relational algebra operations include UNION, INTERSECTION, DIFFERENCE, CARTESIAN PRODUCT, PROJECT, JOIN, and a couple of others. In this project, you are only required to implement these operations specified here, but you are most welcome to cover the remaining ones. Requirement I You are to write a Java program that performs basic relational algebra operations on tables.

1. Use the provided data file for T1 and T2 as your input source. "T1.txt" consists of:

ID Name

1 A

26 Z

3 C

"T2.txt" input file consists of:

ID Name

1 A

2 B

3 C

2. Perform the relational algebra operations provided above on these tables and display your result.

3. You may be interested on the following references on relational algebra; however, further detail on the concept will be given in class.

4. Web Resources The historical E. F. Codd paper: A Relational Model of Data for Large Shared Data Banks http://www.seas.upenn.edu/~zives/03f/cis550/codd.pdf Wikipedia: http://en.wikipedia.o rg/wiki/Relational_algebra Others: http://db.grussell.org/section010.html http://www.cbcb.umd.edu/confcour/CMSC424/Relational_algebra.pdf http://www.cs.gmu.edu/~jessica/cs450_f11/cs450_Relational_Algebra2.pdf

Requirement II

1. A friendly user interface

2. The source code must be formatted using one of the generally accepted coding conventions.

3.The source code must be documented properly.

Explanation / Answer

The RA interpreter is invoked using the following terminal command:
$ java edu.gsu.cs.ra.RA company
The interpreter responds with the following prompt:
RA>
Keywords for the relational algebraic operators: PROJECT, RENAME, UNION, MINUS,

INTERSECT, JOIN, TIMES, and SELECT.
________________________________________________________________________________
$ java edu.gsu.cs.ra.RA company
RA> T3;
SEMANTIC ERROR in RA Query: Relation T3 does not exist
RA>T1;
T1(TID:INTEGER,TNAME:VARCHAR)
RA> T2;
T2(TTID:INTEGER,TTNAME:VARCHAR)
RA> exit;
$
_______________________________________________________________________________
Syntax:
(1)->   Select
select[condition](expression)
(2)->   Project
project[attribute-list](expression)
(3)->   Rename
rename[attribute-list](expression)
(4)->   Join
(expression1 join expression2)
(5)->   Times
(expression1 times expression2)
(6)->   Union
(expression1 union expression2)
(7)->   Intersect
(expression1 intersect expression2)
________________________________________________________________________________
Some example to work with RA interpreter
________________________________________________
Query:
Retrieve name in table T1 whose name in T2 is A.
project[tname](
(rename[ttid,ttname](select [ttname='A'](t2))
join t1
)
);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote