Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. can someone please help me to solve the relational algebra equation?

can someone please help me to solve the relational algebra equation?

Scheduled Pinned Locked Moved Database
saleshelpquestion
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    CUSTOMER (Cust#, Cname, City) ORDER (Order#, Odate, Cust#, Ord_Amt) ORDER_ITEM (Order#, Item#, Qty) ITEM (Item#, Unit_price) SHIPMENT (Order#, Warehouse#, Ship_Date) WAREHOUSE (Warehouse#, City) List the orders that were not shipped within 14 days of ordering. Produce a list of Cname who has not placed any orders.

    L T B D 4 Replies Last reply
    0
    • L Lost User

      CUSTOMER (Cust#, Cname, City) ORDER (Order#, Odate, Cust#, Ord_Amt) ORDER_ITEM (Order#, Item#, Qty) ITEM (Item#, Unit_price) SHIPMENT (Order#, Warehouse#, Ship_Date) WAREHOUSE (Warehouse#, City) List the orders that were not shipped within 14 days of ordering. Produce a list of Cname who has not placed any orders.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      It's not a "relational algebra equation" - the assignment is to write a thing called a "query". A "select query" to be more exact. I can help with the assignment if you have a specific question, but I'm not going to give the solution. If you're looking how to get started, then I suggest you write a script to generate said tables with some testdata.

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

      1 Reply Last reply
      0
      • L Lost User

        CUSTOMER (Cust#, Cname, City) ORDER (Order#, Odate, Cust#, Ord_Amt) ORDER_ITEM (Order#, Item#, Qty) ITEM (Item#, Unit_price) SHIPMENT (Order#, Warehouse#, Ship_Date) WAREHOUSE (Warehouse#, City) List the orders that were not shipped within 14 days of ordering. Produce a list of Cname who has not placed any orders.

        T Offline
        T Offline
        Tim Carmichael
        wrote on last edited by
        #3

        If this is a relational algebra question in the sense of just math, probably can't help. If it is a database question looking for a query, something like: select order.order# from order o left outer join shipment s on order.order# = shipment.order# where (shipment.ship_date is null and datediff(d, order.odate, getdate()) > 14) or datediff(d, order.odate, shipment.ship_date) > 14 select cname from (select cname, o.cust#, count(o.order#) from customer c left outer join order o on c.cust# = o.cust# group by cname, o.cust# having count(o.order#) = 0)

        C L 2 Replies Last reply
        0
        • T Tim Carmichael

          If this is a relational algebra question in the sense of just math, probably can't help. If it is a database question looking for a query, something like: select order.order# from order o left outer join shipment s on order.order# = shipment.order# where (shipment.ship_date is null and datediff(d, order.odate, getdate()) > 14) or datediff(d, order.odate, shipment.ship_date) > 14 select cname from (select cname, o.cust#, count(o.order#) from customer c left outer join order o on c.cust# = o.cust# group by cname, o.cust# having count(o.order#) = 0)

          C Offline
          C Offline
          Chris Quinn
          wrote on last edited by
          #4

          Much better for the second query:

          select cname
          from CUSTOMER c
          left join [ORDER] o
          on c.cust# = o.cust#
          WHERE o.order# IS NULL

          ========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================

          1 Reply Last reply
          0
          • T Tim Carmichael

            If this is a relational algebra question in the sense of just math, probably can't help. If it is a database question looking for a query, something like: select order.order# from order o left outer join shipment s on order.order# = shipment.order# where (shipment.ship_date is null and datediff(d, order.odate, getdate()) > 14) or datediff(d, order.odate, shipment.ship_date) > 14 select cname from (select cname, o.cust#, count(o.order#) from customer c left outer join order o on c.cust# = o.cust# group by cname, o.cust# having count(o.order#) = 0)

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Tim Carmichael wrote:

            If this is ...

            It's actually a homework question.

            1 Reply Last reply
            0
            • L Lost User

              CUSTOMER (Cust#, Cname, City) ORDER (Order#, Odate, Cust#, Ord_Amt) ORDER_ITEM (Order#, Item#, Qty) ITEM (Item#, Unit_price) SHIPMENT (Order#, Warehouse#, Ship_Date) WAREHOUSE (Warehouse#, City) List the orders that were not shipped within 14 days of ordering. Produce a list of Cname who has not placed any orders.

              B Offline
              B Offline
              Bernhard Hiller
              wrote on last edited by
              #6

              Do not repost! List the orders that were not shipped within 14 days of ordering.[^]

              1 Reply Last reply
              0
              • L Lost User

                CUSTOMER (Cust#, Cname, City) ORDER (Order#, Odate, Cust#, Ord_Amt) ORDER_ITEM (Order#, Item#, Qty) ITEM (Item#, Unit_price) SHIPMENT (Order#, Warehouse#, Ship_Date) WAREHOUSE (Warehouse#, City) List the orders that were not shipped within 14 days of ordering. Produce a list of Cname who has not placed any orders.

                D Offline
                D Offline
                data modeling guy
                wrote on last edited by
                #7
                1. ∏{order#} (∑{datediff(ODate,Today)>14} (REN o(ORDER) θ{o.order#=ons.order#} REN ons( ∏ {oredr#} (ORDER) - ∏ {oredr#} (SHIPMENT)))) 2) ∏{CName} (REN c(CUSTOMER) θ{c.Cust#=onp.Cust#} REN onp( ∏ {Cust#} (CUSTOMER) - ∏ {Cust#} (ORDER))) Operators used: ∑ is SELECT ∏ is PROJECT θ is THETA JOIN - is SET DIFFERENCE REN is RENAME {} is for enclosing expressions
                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups