Example #1
0
        /*
         * select sum(f.price)
         * from flights f, company c
         * where f.companyName = c.name and c.name = "Lufthansa"
         */

        public double Query6()
        {
            return
                (FlightTable.joinFunc(
                     CompanyTable, t => t.Item1.CompanyName == t.Item2.Name && t.Item2.Name == "Lufthansa").Reduce(
                     0.0, (s, t) => s += t.Item1.Price));
        }
Example #2
0
        /*
         * select *
         * from flights f, airport a
         * where f.destinationAirport = a.name && f.destinationCity = a.city
         * */

        public IEnumerable <Tuple <Flight, Airport> > Query4()
        {
            return
                (FlightTable.joinFunc
                     (AirportTable, t => t.Item1.DestinationAirport == t.Item2.Name &&
                     t.Item1.DestinationCity == t.Item2.City));
        }
Example #3
0
        /*
         * select f.code, f.company, a.size
         * from flights f, airport a
         * where f.destinationAirport = a.name && f.destinationCity = a.city && f.company = Lufthansa
         * */

        public IEnumerable <Tuple <string, string, AirportSize> > Query5()
        {
            return
                (FlightTable.joinFunc(
                     AirportTable, t => t.Item1.DestinationAirport == t.Item2.Name &&
                     t.Item1.DestinationCity == t.Item2.City &&
                     t.Item1.CompanyName == "Lufthansa").Map(
                     t => new Tuple <string, string, AirportSize>(t.Item1.Code, t.Item1.CompanyName, t.Item2.Size)));
        }