Commit 877c4881 authored by haoyuz3's avatar haoyuz3
Browse files

add question 1 4 6 7

parent 1bf1e2c8
......@@ -3,9 +3,6 @@ SET client_encoding = 'UTF8';
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
CREATE EXTENSION IF NOT EXISTS provsql WITH SCHEMA public;
-- Formula semiring
CREATE TYPE public.formula_state AS (
formula text,
nbargs integer
......@@ -17,6 +14,19 @@ CREATE FUNCTION public.formula_monus(formula1 text, formula2 text) RETURNS text
SELECT concat('(',formula1,' ⊖ ',formula2,')')
$$;
CREATE FUNCTION public.formula_semimod(formula1 text, formula2 text) RETURNS text
LANGUAGE sql IMMUTABLE STRICT
AS $$
SELECT concat('(',formula1,' * ',formula2,')')
$$;
CREATE FUNCTION public.formula_delta(formula text) RETURNS text
LANGUAGE sql IMMUTABLE STRICT
AS $$
SELECT concat('δ(',formula,')')
$$;
CREATE FUNCTION public.formula_plus_state(state public.formula_state, value text) RETURNS public.formula_state
LANGUAGE plpgsql IMMUTABLE
AS $$
......@@ -29,6 +39,18 @@ BEGIN
END
$$;
CREATE FUNCTION public.formula_agg_state(state public.formula_state, value text) RETURNS public.formula_state
LANGUAGE plpgsql IMMUTABLE
AS $$
BEGIN
IF state IS NULL OR state.nbargs=0 THEN
RETURN (value,1);
ELSE
RETURN (concat(state.formula,' , ',value),state.nbargs+1);
END IF;
END
$$;
CREATE FUNCTION public.formula_state2formula(state public.formula_state) RETURNS text
LANGUAGE sql IMMUTABLE STRICT
AS $$
......@@ -39,6 +61,16 @@ CREATE FUNCTION public.formula_state2formula(state public.formula_state) RETURNS
END;
$$;
CREATE FUNCTION public.agg_state2formula(state public.formula_state) RETURNS text
LANGUAGE sql IMMUTABLE STRICT
AS $$
SELECT
CASE
WHEN state.nbargs<2 THEN state.formula
ELSE concat('(',state.formula,')')
END;
$$;
CREATE FUNCTION public.formula_times_state(state public.formula_state, value text) RETURNS public.formula_state
LANGUAGE plpgsql IMMUTABLE
AS $$
......@@ -51,6 +83,34 @@ BEGIN
END
$$;
CREATE AGGREGATE public.formula_plus(text) (
SFUNC = public.formula_plus_state,
STYPE = public.formula_state,
INITCOND = '(𝟘,0)',
FINALFUNC = public.formula_state2formula
);
CREATE AGGREGATE public.formula_times(text) (
SFUNC = public.formula_times_state,
STYPE = public.formula_state,
INITCOND = '(𝟙,0)',
FINALFUNC = public.formula_state2formula
);
CREATE AGGREGATE public.formula_agg(text) (
SFUNC = public.formula_agg_state,
STYPE = public.formula_state,
INITCOND = '(1,0)'
--FINALFUNC = public.formula_state2formula
);
CREATE FUNCTION public.formula_agg_final(state public.formula_state, fname varchar) RETURNS text
LANGUAGE sql IMMUTABLE STRICT
AS
$$
SELECT concat(fname,'{ ',state.formula,' }');
$$;
CREATE FUNCTION public.formula(token provsql.provenance_token, token2value regclass) RETURNS text
LANGUAGE plpgsql
AS $$
......@@ -61,27 +121,29 @@ BEGIN
'𝟙'::text,
'formula_plus',
'formula_times',
'formula_monus');
'formula_monus',
'formula_delta');
END
$$;
-- Counting semiring
CREATE FUNCTION public.counting(token provsql.provenance_token, token2value regclass) RETURNS integer
CREATE FUNCTION public.aggregation_formula(token anyelement, token2value regclass) RETURNS text
LANGUAGE plpgsql
AS $$
BEGIN
RETURN provenance_evaluate(
token,
RETURN provsql.aggregation_evaluate(
token::provsql.provenance_token,
token2value,
1,
'counting_plus',
'counting_times',
'counting_monus');
'formula_agg_final',
'formula_agg',
'formula_semimod',
'𝟙'::text,
'formula_plus',
'formula_times',
'formula_monus',
'formula_delta');
END
$$;
-- Counting semiring
CREATE FUNCTION public.counting_monus(counting1 integer, counting2 integer) RETURNS integer
LANGUAGE sql IMMUTABLE STRICT
......@@ -89,6 +151,12 @@ CREATE FUNCTION public.counting_monus(counting1 integer, counting2 integer) RETU
SELECT CASE WHEN counting1 < counting2 THEN 0 ELSE counting1 - counting2 END
$$;
CREATE FUNCTION public.counting_delta(counting integer) RETURNS integer
LANGUAGE sql IMMUTABLE STRICT
AS $$
SELECT CASE WHEN counting > 0 THEN 1 ELSE 1 END
$$;
CREATE FUNCTION public.counting_plus_state(state integer, value integer) RETURNS integer
LANGUAGE sql IMMUTABLE
AS $$
......@@ -113,17 +181,17 @@ CREATE AGGREGATE public.counting_times(integer) (
INITCOND = '1'
);
CREATE AGGREGATE public.formula_plus(text) (
SFUNC = public.formula_plus_state,
STYPE = public.formula_state,
INITCOND = '(𝟘,0)',
FINALFUNC = public.formula_state2formula
);
CREATE AGGREGATE public.formula_times(text) (
SFUNC = public.formula_times_state,
STYPE = public.formula_state,
INITCOND = '(𝟙,0)',
FINALFUNC = public.formula_state2formula
);
CREATE FUNCTION public.counting(token provsql.provenance_token, token2value regclass) RETURNS integer
LANGUAGE plpgsql
AS $$
BEGIN
RETURN provenance_evaluate(
token,
token2value,
1,
'counting_plus',
'counting_times',
'counting_monus',
'counting_delta');
END
$$;
\ No newline at end of file
SELECT p1.BrandName, COUNT(DISTINCT p2.CustomerId) as NumOfCustomers FROM Purchases p2 RIGHT JOIN Products p1 ON p2.ProductId = p1.ProductId GROUP BY p1.BrandName ORDER BY NumOfCustomers DESC, p1.BrandName ASC;
\ No newline at end of file
SELECT p1.BrandName, COUNT(DISTINCT p2.CustomerId) FROM Purchases p2 RIGHT JOIN Products p1 ON p2.ProductId = p1.ProductId GROUP BY p1.BrandName;
\ No newline at end of file
SELECT FirstName, LastName, COUNT(PurchaseId) AS cnt FROM Customers LEFT JOIN Purchases USING (CustomerId) GROUP BY FirstName, LastName ORDER BY FirstName, LastName DESC;
\ No newline at end of file
SELECT FirstName, LastName, COUNT(PurchaseId) FROM Customers LEFT JOIN Purchases USING (CustomerId) GROUP BY FirstName, LastName;
\ No newline at end of file
......@@ -55,7 +55,7 @@ def main():
extractData()
#print(query)
for question_id in [1,2,3,4,5,6,7,8]:
if question_id != 1:
if question_id != 7:
continue
f = open("hw1-provenance/q"+str(question_id)+".txt", "w+")
question_submissions = query[question_id]
......@@ -64,7 +64,11 @@ def main():
for sub_id in list(submissions.keys()):
try:
commitAndExecute(conn, cur, submissions[sub_id])
f.write(submissions[sub_id]+"\n")
tmp = cur.fetchall()
if len(tmp) != 0:
tt = submissions[sub_id]
idx = tt.lower().find("order")
f.write(tt[:idx]+"\n")
except (Exception, psycopg2.DatabaseError) as error:
print(submissions[sub_id], error)
conn.commit()
......
This diff is collapsed.
SELECT Students.FirstName, Students.LastName, Courses.Instructor FROM Students INNER JOIN Enrollments ON Students.NetId=Enrollments.NetId INNER JOIN Courses ON Enrollments.CRN=Courses.CRN WHERE (Students.FirstName LIKE 'A%' OR Students.LastName LIKE 'A%') AND (Courses.Instructor LIKE 'A%');
provenance formula | FirstName | LastName | Instructor | provsql-token
FirstName | LastName | Instructor | provenance formula | provsql-token
(students.t5 ⊗ enrollments.t10 ⊗ courses.t1) | Aero | AeroSmith | Abdu Alawini | b440ab49-79d6-55e6-9b60-e58cd002527f
(students.t6 ⊗ enrollments.t11 ⊗ courses.t1) | Amy | Alan | Abdu Alawini | 3d0d85b3-f3b5-5c08-9a9f-ea92b8a093e8
Aero | AeroSmith | Abdu Alawini | (students.t5 ⊗ enrollments.t10 ⊗ courses.t1) | 5b3ea7d2-be58-57fb-9f73-575481d961cc
Amy | Alan | Abdu Alawini | (students.t6 ⊗ enrollments.t11 ⊗ courses.t1) | e47086d7-ae21-5b76-9c9e-e2fe05f5d13f
---------------------------
SELECT E.CRN,C.Title,C.Department, AVG(Score) FROM Enrollments E, Courses C WHERE E.CRN = C.CRN AND C.Department='ECE' GROUP BY E.CRN,C.Title,C.Department HAVING AVG(Score) > 70 ORDER BY AVG(Score) DESC;
\ No newline at end of file
SELECT E.CRN,C.Title,C.Department, AVG(Score) FROM Enrollments E, Courses C WHERE E.CRN = C.CRN AND C.Department='ECE' GROUP BY E.CRN,C.Title,C.Department HAVING AVG(Score) > 70 ORDER BY AVG(Score) DESC;
provenance formula | CRN | Title | Department | AVG(Score) | provsql-token
---------------------------
SELECT BrandName, COUNT(DISTINCT CustomerId) FROM Purchases p LEFT JOIN Products pr ON p.ProductId = pr.ProductId GROUP by BrandName
SELECT BrandName, COUNT(DISTINCT CustomerId) FROM Purchases p JOIN Products pr ON p.ProductId = pr.ProductId GROUP by BrandName
SELECT BrandName, COUNT(DISTINCT CustomerId) FROM Products pr LEFT JOIN Purchases p ON pr.ProductId = p.ProductId GROUP by BrandName
SELECT BrandName, COUNT(CustomerId) FROM Purchases p JOIN Products pr ON p.ProductId = pr.ProductId GROUP by BrandName
SELECT BrandName, COUNT(DISTINCT CustomerId) FROM Products pr LEFT JOIN Purchases p ON pr.ProductId = p.ProductId GROUP by BrandName
select * from Customers c natural join Purchases p natural join Products
select * from Customers c natural join Purchases
select * from (Customers c natural join Purchases p) a natural join Products
select * from (Customers c natural join Purchases p) cp natural join Products p
select pd.BrandName, count(distinct pu.CustomerId) from Products pd left join Purchases pu on (pd.ProductId = pu.ProductId) group by pd.BrandName
select * from (Customers c natural join Purchases p) cp natural join Products p
SELECT BrandName, COUNT(CustomerId) FROM Purchases RIGHT JOIN Products on Purchases.ProductID = Products.ProductID Group By BrandName
SELECT BrandName, COUNT(Distinct CustomerId) FROM Purchases RIGHT JOIN Products on Purchases.ProductID = Products.ProductID Group By BrandName
SELECT BrandName, COUNT(CustomerId) FROM Products LEFT JOIN Purchases on Products.ProductID = Purchases.ProductID Group By BrandName
SELECT BrandName, COUNT(Distinct CustomerId) FROM Purchases RIGHT JOIN Products on Purchases.ProductID = Products.ProductID Group By BrandName
SELECT BrandName, COUNT(DISTINCT CustomerId) FROM Purchases Left Join Products on Purchases.ProductId=Products.ProductId GROUP BY BrandName
SELECT BrandName, COUNT(DISTINCT CustomerId) FROM Products Left Join Purchases on Purchases.ProductId=Products.ProductId GROUP BY BrandName
SELECT BrandName, COUNT(DISTINCT CustomerId) FROM Purchases Join Products on Purchases.ProductId=Products.ProductId GROUP BY BrandName
SELECT Products.BrandName, COUNT(Purchases.CustomerId) FROM Products JOIN Purchases ON Products.ProductId = Purchases.ProductId GROUP BY Products.BrandName
SELECT Products.BrandName, COUNT(Purchases.CustomerId) FROM Purchases LEFT OUTER JOIN Products ON Products.ProductId = Purchases.ProductId GROUP BY Products.BrandName
SELECT Products.BrandName, COUNT(Purchases.CustomerId) FROM Products LEFT OUTER JOIN Purchases ON Products.ProductId = Purchases.ProductId GROUP BY Products.BrandName
SELECT Brands.BrandName, COUNT(Purchases.CustomerId) FROM Brands JOIN Products ON Brands.BrandName = Products.BrandName JOIN Purchases ON Products.ProductId = Purchases.ProductId GROUP BY Brands.BrandName
SELECT Brands.BrandName, COUNT(Purchases.CustomerId) FROM Brands LEFT OUTER JOIN Products ON Brands.BrandName = Products.BrandName LEFT OUTER JOIN Purchases ON Products.ProductId = Purchases.ProductId GROUP BY Brands.BrandName
SELECT Products.BrandName, COUNT(Purchases.CustomerId) FROM Products LEFT OUTER JOIN Purchases ON Products.ProductId = Purchases.ProductId GROUP BY Products.BrandName
SELECT Products.BrandName, COUNT(Purchases.CustomerId) FROM Products LEFT OUTER JOIN Purchases ON Products.ProductId = Purchases.ProductId GROUP BY Products.ProductId
SELECT Products.BrandName, COUNT(distinct Purchases.CustomerId) FROM Products LEFT OUTER JOIN Purchases ON Products.ProductId = Purchases.ProductId GROUP BY Products.BrandName
SELECT Products.BrandName, COUNT(Purchases.CustomerId) FROM Products LEFT OUTER JOIN Purchases ON Products.ProductId = Purchases.ProductId GROUP BY Products.BrandName
SELECT DISTINCT PurchaseId, CustomerId, ProductId, Price FROM Purchases p
This diff is collapsed.
SELECT p1.BrandName, COUNT(DISTINCT p2.CustomerId) FROM Purchases p2 RIGHT JOIN Products p1 ON p2.ProductId = p1.ProductId GROUP BY p1.BrandName;
BrandName | CustomerId) | provenance formula | provsql-token
Apple | count{ (1 * (t50 ⊗ 𝟙)) , (1 * (t1 ⊗ 𝟙)) , (1 * (t16 ⊗ 𝟙)) , (1 * (t17 ⊗ 𝟙)) , (1 * (t18 ⊗ 𝟙)) , (1 * (t19 ⊗ 𝟙)) , (1 * (t22 ⊗ 𝟙)) , (1 * (t23 ⊗ 𝟙)) , (1 * (t24 ⊗ 𝟙)) , (1 * (t25 ⊗ 𝟙)) , (1 * (t27 ⊗ 𝟙)) , (1 * (t28 ⊗ 𝟙)) , (1 * (t29 ⊗ 𝟙)) , (1 * (t30 ⊗ 𝟙)) , (1 * (t32 ⊗ 𝟙)) , (1 * (t33 ⊗ 𝟙)) , (1 * (t39 ⊗ 𝟙)) , (1 * (t40 ⊗ 𝟙)) , (1 * (t41 ⊗ 𝟙)) , (1 * (t44 ⊗ 𝟙)) , (1 * (t45 ⊗ 𝟙)) , (1 * (t46 ⊗ 𝟙)) , (1 * (t0 ⊗ 𝟙)) , (1 * (t3 ⊗ 𝟙)) , (1 * (t5 ⊗ 𝟙)) , (1 * (t6 ⊗ 𝟙)) , (1 * (t8 ⊗ 𝟙)) , (1 * (t10 ⊗ 𝟙)) , (1 * (t13 ⊗ 𝟙)) , (1 * (t15 ⊗ 𝟙)) } | a4f51fba-9654-5b82-ab59-f8d9771ef4ca
Google | count{ (1 * (t14 ⊗ 𝟙)) , (1 * (t12 ⊗ 𝟙)) , (1 * (t35 ⊗ 𝟙)) , (1 * (t36 ⊗ 𝟙)) , (1 * (t37 ⊗ 𝟙)) , (1 * (t43 ⊗ 𝟙)) } | cb6a3a50-a53f-5bda-a6ab-2a62d94dfd73
Honor | count{ (1 * (t34 ⊗ 𝟙)) , (1 * (t4 ⊗ 𝟙)) , (1 * (t47 ⊗ 𝟙)) , (1 * (t42 ⊗ 𝟙)) } | e2337af1-d092-580b-a302-0455b6a2bcae
OnePlus | count{ (1 * (t48 ⊗ 𝟙)) , (1 * (t20 ⊗ 𝟙)) , (1 * (t38 ⊗ 𝟙)) , (1 * (t11 ⊗ 𝟙)) } | 4f84812e-111c-57df-9989-01528f0dcdba
Samsung | count{ (1 * (t9 ⊗ 𝟙)) , (1 * (t2 ⊗ 𝟙)) , (1 * (t7 ⊗ 𝟙)) , (1 * (t31 ⊗ 𝟙)) , (1 * (t21 ⊗ 𝟙)) , (1 * (t26 ⊗ 𝟙)) , (1 * (t49 ⊗ 𝟙)) } | 2b3043bc-df51-5e66-bd5a-20c26e8324ad
---------------------------
Apple | count{ (1 * (𝟙 ⊗ t4)) , (1 * (𝟙 ⊗ t3)) , (1 * (𝟙 ⊗ t2)) , (1 * (𝟙 ⊗ t1)) , (1 * (𝟙 ⊗ t2)) , (1 * (𝟙 ⊗ t1)) , (1 * (𝟙 ⊗ t4)) , (1 * (𝟙 ⊗ t0)) , (1 * (𝟙 ⊗ t1)) , (1 * (𝟙 ⊗ t0)) , (1 * (𝟙 ⊗ t2)) , (1 * (𝟙 ⊗ t2)) , (1 * (𝟙 ⊗ t2)) , (1 * (𝟙 ⊗ t4)) , (1 * (𝟙 ⊗ t4)) , (1 * (𝟙 ⊗ t2)) , (1 * (𝟙 ⊗ t3)) , (1 * (𝟙 ⊗ t3)) , (1 * (𝟙 ⊗ t4)) , (1 * (𝟙 ⊗ t1)) , (1 * (𝟙 ⊗ t0)) , (1 * (𝟙 ⊗ t3)) , (1 * (𝟙 ⊗ t4)) , (1 * (𝟙 ⊗ t3)) , (1 * (𝟙 ⊗ t0)) , (1 * (𝟙 ⊗ t1)) , (1 * (𝟙 ⊗ t2)) , (1 * (𝟙 ⊗ t1)) , (1 * (𝟙 ⊗ t2)) , (1 * (𝟙 ⊗ t2)) } | a4f51fba-9654-5b82-ab59-f8d9771ef4ca
Google | count{ (1 * (𝟙 ⊗ t8)) , (1 * (𝟙 ⊗ t8)) , (1 * (𝟙 ⊗ t8)) , (1 * (𝟙 ⊗ t8)) , (1 * (𝟙 ⊗ t8)) , (1 * (𝟙 ⊗ t8)) } | cb6a3a50-a53f-5bda-a6ab-2a62d94dfd73
Honor | count{ (1 * (𝟙 ⊗ t9)) , (1 * (𝟙 ⊗ t9)) , (1 * (𝟙 ⊗ t9)) , (1 * (𝟙 ⊗ t9)) } | e2337af1-d092-580b-a302-0455b6a2bcae
OnePlus | count{ (1 * (𝟙 ⊗ t7)) , (1 * (𝟙 ⊗ t7)) , (1 * (𝟙 ⊗ t7)) , (1 * (𝟙 ⊗ t7)) } | 4f84812e-111c-57df-9989-01528f0dcdba
Samsung | count{ (1 * (𝟙 ⊗ t5)) , (1 * (𝟙 ⊗ t5)) , (1 * (𝟙 ⊗ t5)) , (1 * (𝟙 ⊗ t6)) , (1 * (𝟙 ⊗ t6)) , (1 * (𝟙 ⊗ t5)) , (1 * (𝟙 ⊗ t5)) } | 2b3043bc-df51-5e66-bd5a-20c26e8324ad
---------------------------
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
SELECT c.FirstName, c.LastName, COUNT(pu.PurchaseId) FROM Customers c LEFT JOIN Purchases pu on c.CustomerId = pu.CustomerId GROUP BY c.CustomerId
SELECT DISTINCT Customers.CustomerId, Purchases.PurchaseId FROM Customers, Purchases
SELECT Customers.FirstName, Customers.LastName, COUNT(Purchases.PurchaseId) FROM Customers JOIN Purchases ON Purchases.CustomerId = Customers.CustomerId GROUP BY Customers.CustomerId
select FirstName, LastName, count(PurchaseId) from Customers left join Purchases on Customers.CustomerId = Purchases.CustomerId group by Customers.CustomerId
select C.FirstName, C.LastName, P.PurchaseId from Customers C natural join Purchases P
SELECT FirstName, LastName, COUNT(PurchaseId) FROM Customers c Left Outer Join Purchases p ON (c.CustomerId = p.CustomerId) GROUP BY c.CustomerId
SELECT FirstName,LastName,COUNT(PurchaseId) FROM Customers c LEFT JOIN Purchases p ON c.CustomerId=p.CustomerId GROUP BY c.CustomerId
select c.FirstName, c.LastName, count(p.PurchaseId) from Customers c join Purchases p on p.CustomerId = c.CustomerId group by c.CustomerId
select c.FirstName, c.LastName, count(p.PurchaseId) from Customers c left join Purchases p on p.CustomerId = c.CustomerId group by c.CustomerId
select c.FirstName, c.LastName, count(p.PurchaseId) from Customers c left join Purchases p on p.CustomerId = c.CustomerId group by c.CustomerId
This diff is collapsed.
SELECT FirstName, LastName, COUNT(PurchaseId) FROM Customers LEFT JOIN Purchases USING (CustomerId) GROUP BY FirstName, LastName;
FirstName | LastName | COUNT(PurchaseId) | provenance formula | provsql-token
Lowell | Best | count{ (1 * (𝟙 ⊗ t46)) } | fd145531-08a1-5c72-ade9-d5069423657f
Adriana | Mendez | count{ (1 * (𝟙 ⊗ t8)) , (1 * (𝟙 ⊗ t10)) , (1 * (𝟙 ⊗ t37)) , (1 * (𝟙 ⊗ t43)) } | 6b39a98c-07c6-58e7-9530-7b26acc42cd4
Luis | Alamilla | count{ (1 * (𝟙 ⊗ t38)) } | 89567215-06f5-5062-a2a2-1acdf868fa80
Josh | Derrickson | count{ (1 * (𝟙 ⊗ t3)) , (1 * (𝟙 ⊗ t12)) , (1 * (𝟙 ⊗ t41)) } | e2c3510d-c461-5d29-9278-8c74d77c7117
Christopher | Ryley | count{ (1 * (𝟙 ⊗ t17)) , (1 * (𝟙 ⊗ t27)) , (1 * (𝟙 ⊗ t28)) } | 35de001d-d942-5dcb-be38-7b7883645b43
Elfreda | Patrick | count{ (1 * (𝟙 ⊗ t16)) , (1 * (𝟙 ⊗ t34)) } | 86363850-e484-50bc-9211-575635c559bd
Barry | Easom | count{ (1 * (𝟙 ⊗ t29)) } | 574c18e0-6df5-5270-8c57-31db7f37c504
Kelly | Jerome | count{ (1 * (𝟙 ⊗ t47)) } | a0feaf0c-7f51-50b5-9eeb-ea15b929b4d6
James | Grenville | count{ (1 * (𝟙 ⊗ t15)) } | 98c77ad2-384f-58b3-9880-a69fc9bb8454
Ellie | Ball | count{ (1 * (𝟙 ⊗ t1)) , (1 * (𝟙 ⊗ t40)) } | c18c4a1d-98df-5ae3-9620-5d7b2ecded0e
Jannah | Gladyn | count{ (1 * (𝟙 ⊗ t0)) , (1 * (𝟙 ⊗ t2)) , (1 * (𝟙 ⊗ t9)) , (1 * (𝟙 ⊗ t20)) , (1 * (𝟙 ⊗ t44)) , (1 * (𝟙 ⊗ t50)) } | c302023d-3e0a-5a02-b264-b44ecf6b25f5
Aretha | Tyson | count{ (1 * (𝟙 ⊗ t22)) } | e347350a-02ff-5209-a47a-83864d2605cd
Eleanora | Lacey | count{ (1 * (𝟙 ⊗ t5)) , (1 * (𝟙 ⊗ t11)) , (1 * (𝟙 ⊗ t21)) , (1 * (𝟙 ⊗ t31)) } | 798f51b4-ff1c-528e-ae4b-e1b3af4f10ee
Wesley | Herman | count{ (1 * (𝟙 ⊗ t30)) , (1 * (𝟙 ⊗ t49)) } | fc8b54a2-73ae-5c4f-9287-345950aef46f
Jenna | Watts | count{ (1 * (𝟙 ⊗ t19)) , (1 * (𝟙 ⊗ t36)) } | a1442e72-1d58-5c18-9f8e-17c28856f211
Bethany | Barnet | count{ (1 * (𝟙 ⊗ t6)) , (1 * (𝟙 ⊗ t13)) , (1 * (𝟙 ⊗ t24)) } | ab538f3e-11b4-5dd9-9b43-21e868766327
Rebecca | Harlan | count{ (1 * (𝟙 ⊗ t33)) } | 2aa368f9-894d-5d08-ac48-f152965d2b6c
Stacey | Anthonyson | count{ (1 * (𝟙 ⊗ t18)) } | e8d54434-94ad-5aed-b1f5-c1018ed1805e
Shonda | Winchester | count{ (1 * (𝟙 ⊗ t14)) , (1 * (𝟙 ⊗ t45)) } | d18ced60-f6d0-5e6e-a988-0c5df6e731c8
Jez | Hopper | count{ (1 * (𝟙 ⊗ t42)) } | 72bea140-2c31-5bf2-a50c-ab0af1fa8207
Jayme | Castle | count{ (1 * (𝟙 ⊗ t35)) , (1 * (𝟙 ⊗ t39)) } | 100692c0-5bbc-5aa6-836b-29700f34a497
Deven | Miles | count{ (1 * (𝟙 ⊗ t7)) , (1 * (𝟙 ⊗ t25)) } | 6e14b949-e5a1-5a59-aa4b-7e0bca10585d
Luisa | Alamilla | count{ (1 * (𝟙 ⊗ t48)) } | 6c4490eb-c01d-53f7-afe5-6e9f76b79a2b
Haylie | Roy | count{ (1 * (𝟙 ⊗ t23)) , (1 * (𝟙 ⊗ t26)) } | e7d47395-d8ff-54df-9856-3f175c72c838
Janet | Ogden | count{ (1 * (𝟙 ⊗ t4)) , (1 * (𝟙 ⊗ t32)) } | 4a564fe9-d6a0-511f-b8bf-96fb112ecbca
---------------------------
Lowell | Best | count{ (1 * (t10 ⊗ 𝟙)) } | fd145531-08a1-5c72-ade9-d5069423657f
Adriana | Mendez | count{ (1 * (t22 ⊗ 𝟙)) , (1 * (t22 ⊗ 𝟙)) , (1 * (t22 ⊗ 𝟙)) , (1 * (t22 ⊗ 𝟙)) } | 6b39a98c-07c6-58e7-9530-7b26acc42cd4
Luis | Alamilla | count{ (1 * (t24 ⊗ 𝟙)) } | 89567215-06f5-5062-a2a2-1acdf868fa80
Josh | Derrickson | count{ (1 * (t8 ⊗ 𝟙)) , (1 * (t8 ⊗ 𝟙)) , (1 * (t8 ⊗ 𝟙)) } | e2c3510d-c461-5d29-9278-8c74d77c7117
Christopher | Ryley | count{ (1 * (t5 ⊗ 𝟙)) , (1 * (t5 ⊗ 𝟙)) , (1 * (t5 ⊗ 𝟙)) } | 35de001d-d942-5dcb-be38-7b7883645b43
Elfreda | Patrick | count{ (1 * (t2 ⊗ 𝟙)) , (1 * (t2 ⊗ 𝟙)) } | 86363850-e484-50bc-9211-575635c559bd
Barry | Easom | count{ (1 * (t6 ⊗ 𝟙)) } | 574c18e0-6df5-5270-8c57-31db7f37c504
Kelly | Jerome | count{ (1 * (t18 ⊗ 𝟙)) } | a0feaf0c-7f51-50b5-9eeb-ea15b929b4d6
James | Grenville | count{ (1 * (t3 ⊗ 𝟙)) } | 98c77ad2-384f-58b3-9880-a69fc9bb8454
Ellie | Ball | count{ (1 * (t12 ⊗ 𝟙)) , (1 * (t12 ⊗ 𝟙)) } | c18c4a1d-98df-5ae3-9620-5d7b2ecded0e
Jannah | Gladyn | count{ (1 * (t11 ⊗ 𝟙)) , (1 * (t11 ⊗ 𝟙)) , (1 * (t11 ⊗ 𝟙)) , (1 * (t11 ⊗ 𝟙)) , (1 * (t11 ⊗ 𝟙)) , (1 * (t11 ⊗ 𝟙)) } | c302023d-3e0a-5a02-b264-b44ecf6b25f5
Aretha | Tyson | count{ (1 * (t7 ⊗ 𝟙)) } | e347350a-02ff-5209-a47a-83864d2605cd
Eleanora | Lacey | count{ (1 * (t0 ⊗ 𝟙)) , (1 * (t0 ⊗ 𝟙)) , (1 * (t0 ⊗ 𝟙)) , (1 * (t0 ⊗ 𝟙)) } | 798f51b4-ff1c-528e-ae4b-e1b3af4f10ee
Wesley | Herman | count{ (1 * (t1 ⊗ 𝟙)) , (1 * (t1 ⊗ 𝟙)) } | fc8b54a2-73ae-5c4f-9287-345950aef46f
Jenna | Watts | count{ (1 * (t13 ⊗ 𝟙)) , (1 * (t13 ⊗ 𝟙)) } | a1442e72-1d58-5c18-9f8e-17c28856f211
Bethany | Barnet | count{ (1 * (t19 ⊗ 𝟙)) , (1 * (t19 ⊗ 𝟙)) , (1 * (t19 ⊗ 𝟙)) } | ab538f3e-11b4-5dd9-9b43-21e868766327
Rebecca | Harlan | count{ (1 * (t9 ⊗ 𝟙)) } | 2aa368f9-894d-5d08-ac48-f152965d2b6c
Stacey | Anthonyson | count{ (1 * (t14 ⊗ 𝟙)) } | e8d54434-94ad-5aed-b1f5-c1018ed1805e
Shonda | Winchester | count{ (1 * (t17 ⊗ 𝟙)) , (1 * (t17 ⊗ 𝟙)) } | d18ced60-f6d0-5e6e-a988-0c5df6e731c8
Jez | Hopper | count{ (1 * (t15 ⊗ 𝟙)) } | 72bea140-2c31-5bf2-a50c-ab0af1fa8207
Jayme | Castle | count{ (1 * (t4 ⊗ 𝟙)) , (1 * (t4 ⊗ 𝟙)) } | 100692c0-5bbc-5aa6-836b-29700f34a497
Deven | Miles | count{ (1 * (t20 ⊗ 𝟙)) , (1 * (t20 ⊗ 𝟙)) } | 6e14b949-e5a1-5a59-aa4b-7e0bca10585d
Luisa | Alamilla | count{ (1 * (t23 ⊗ 𝟙)) } | 6c4490eb-c01d-53f7-afe5-6e9f76b79a2b
Haylie | Roy | count{ (1 * (t21 ⊗ 𝟙)) , (1 * (t21 ⊗ 𝟙)) } | e7d47395-d8ff-54df-9856-3f175c72c838
Janet | Ogden | count{ (1 * (t16 ⊗ 𝟙)) , (1 * (t16 ⊗ 𝟙)) } | 4a564fe9-d6a0-511f-b8bf-96fb112ecbca
---------------------------
SELECT FirstName, LastName, COUNT(PurchaseId) FROM Customers LEFT JOIN Purchases USING (CustomerId) GROUP BY FirstName, LastName;@SELECT FirstName, LastName, aggregation_formula(COUNT(PurchaseId), 'purchases_provtuple_mapping') FROM Customers LEFT JOIN Purchases USING (CustomerId) GROUP BY FirstName, LastName;#SELECT FirstName, LastName, aggregation_formula(COUNT(PurchaseId), 'customers_provtuple_mapping') FROM Customers LEFT JOIN Purchases USING (CustomerId) GROUP BY FirstName, LastName;#@purchases#customers#
......@@ -22,6 +22,7 @@ SET default_tablespace = '';
SET default_with_oids = false;
--
-- TOC entry 199 (class 1259 OID 17072)
-- Name: brands; Type: TABLE; Schema: public; Owner: postgres
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment