Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace CSE462
- {
- class Program
- {
- #region Methods (1)
- // Private Methods (1)
- static void Main(string[] args)
- {
- var es = new Schema(
- "Employee",
- new Attribute("Name"),
- new Attribute("EmpId"),
- new Attribute("DeptName"),
- new Attribute( "CompanyAge" )
- );
- var ds = new Schema(
- "Dept",
- new Attribute( "DeptName" ),
- new Attribute( "Manager" ),
- new Attribute( "DeptAge" )
- );
- var employees = new Relation(es);
- var depts = new Relation(ds);
- employees.AddTuples(
- new Tuple( "Harry", "3415", "Finance", "10" ),
- new Tuple( "Sally", "2241", "Sales", "7" ),
- new Tuple( "George", "3401", "Finance", "8" ),
- new Tuple( "Harriet", "2202", "Sales", "1" )
- );
- depts.AddTuples(
- new Tuple( "Finance", "George", "20" ),
- new Tuple( "Sales", "Harriet", "1" ),
- new Tuple( "Production", "Charles", "2" )
- );
- var result = RelationalAlgebra.Rename(
- RelationalAlgebra.Projection(
- RelationalAlgebra.Selection(
- RelationalAlgebra.NaturalJoin(
- employees,
- depts
- ), new Predicate("Manager = 'Harriet' && EmpId > 2240")
- ) ,new Attribute("EmpId"), new Attribute("DeptName")),
- new Attribute("Banana"), new Attribute("Boo"));
- System.Console.Write(result);
- System.Console.ReadLine();
- }
- #endregion Methods
- }
- }
Add Comment
Please, Sign In to add comment