Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Recall the shopping database schema. Consider a list of pairs of product ids (P1, P2), ..., (Pn-1, Pn). Such a list is called pair-distinct if
Recall the shopping database schema. Consider a list of pairs of product ids (P1, P2), ..., (Pn-1, Pn). Such a list is called pair-distinct if and only if for any element (P1, P2) of the list, it is not the case that (p2, P1) is also an element of the list. Which one of the below Datalog programs expresses the natural language query List all pair-distinct product ids of all products that have been purchased on the same date and for the same unit price"? A(P1, P2) :- purchase(T1, C1, S1, P1, D, Q1, P), purchase(T2, C2, S2, P2, D, Q2, P), P1 P2 ?A(P1, P2) A(P1, P2) :- purchase(T1, C1, S1, P1, D1, Q1, P), purchase(T2, C2, S2, P2, D2, Q2, P), P1 P2 ?A(P1, P2) o A(P1, P2) :- purchase(T1, C1, S1, P1, D, Q1, P), purchase(T2, C2, S2, P2, D, Q2, P) ?A(P1, P2)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started