Answer the question
In order to leave comments, you need to log in
Which JOIN to use to create a multiplication table?
Hey!
Here, when talking with HR, for the test, they asked me what was in the title. There is no more input.
Actually, I answered randomly. Can you suggest the correct answer and, in principle, give an example?
Very interested.
Answer the question
In order to leave comments, you need to log in
I think they are waiting for the answer CROSS JOIN.
It is necessary to clarify the statement of the problem, but since there is not much more input data, we assume the most obvious: in the table in a certain column of numbers, for them it is necessary to display the multiplication table:
SELECT t1.value * t2.value
FROM tab AS t1 CROSS JOIN tab AS t2
I would send or ask what is the deeper meaning. And so you choose a sequence and in the second column the second and multiply in the third
That's right, if the multiplication table is like this
SELECT
@N:[email protected] + 1 AS '',
(@N * 1) AS '1',
(@N * 2) AS '2',
(@N * 3) AS '3',
(@N * 4) AS '4',
(@N * 5) AS '5',
(@N * 6) AS '6',
(@N * 7) AS '7',
(@N * 8) AS '8',
(@N * 9) AS '9'
FROM
mysql.help_relation,
(SELECT @N:=0) dum
LIMIT 10;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question