Question: Problem 2 here : https://www.chegg.com/homework-help/questions-and-answers/problem-1-https-wwwcheggcom-homework-help-questions-answers-database-systems-sql-problem-1-q23843854 Database systems, SQL Problem 1: Matrix Manipulations While it is not optimal to use SQL for matrix operations, implementation of
Problem 2 here : https://www.chegg.com/homework-help/questions-and-answers/problem-1-https-wwwcheggcom-homework-help-questions-answers-database-systems-sql-problem-1-q23843854
Database systems, SQL
Problem 1: Matrix Manipulations
While it is not optimal to use SQL for matrix operations, implementation of some of the simple ones can get you thinking about attributes the right way.
Assume that a matrix is represented by an index/value representation, each tuple has the form: <i, j, value>. For example, a 2x2 identity matrix would look like this in a SQL table:
| i | j | value |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
For each part, you should provide your query and sample input and output from a mysql run.
a)Write a SQL query that will add two 2-dimensional matrices of arbitrary but equal size, A and B.
b)Write a SQL query that will multiply a matrix A by a scalar, s. Do not use an SFW query and it should be independent of the matrix dimensions.
c)Write a SQL query to multiply two matrices together. The first matrix A must have the same number of rows as the second matrix B has columns. Matrix multiplication is defined as C(i,j) = A(i,k) * B(k,j).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
