M
M
Mitya ToDaSyo2019-08-27 07:40:22
Algorithms
Mitya ToDaSyo, 2019-08-27 07:40:22

How to compare a value with a list (array) using SQL?

  • There are 3 arrays of pre-known numbers:
[1, 5, 9, 12, 14, 16, 19, 23, 27, 30, 32, 34]
[3, 6, 8, 10, 13, 17, 21, 24, 25, 29, 33, 36]
[2, 4, 7, 11, 15, 18, 20, 22, 26, 28, 31, 35]

  • It is necessary to determine which of these arrays the added number belongs to.
  • And get a number, suppose from 1 to 3 (serial number or line name)

For example, a record is entered in table_1, after adding using a trigger, I get the number that was added and I want to make an entry in table_2, where I need to know the name or serial number of line_#.
For clarity, you can take the number 8, it refers to line number 2.
Can I implement this action only using sql?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question