RosettaCodeData/Task/Matrix-multiplication/DuckDB/matrix-multiplication-1.duckdb
2025-08-11 18:05:26 -07:00

7 lines
273 B
Text

# Given two tables, A and B, representing two matrices in (i,j,value) format, the product
# can be computed as follows, with the result being in the same format.
SELECT A.i, B.j,
SUM(A.value * B.value) AS value
FROM A INNER JOIN B
ON A.j = B.i
GROUP BY A.i, B.j;