kiltum (kiltum) wrote,
kiltum
kiltum

А. Да. Мой способ решения.
mysql> desc test;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| a     | int(11) | YES  |     | NULL    |       |
| b     | int(11) | YES  |     | NULL    |       |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.00 sec)

mysql> insert into test values(1,1);
....
mysql> insert into test values(7,7);
mysql> select (a*b) as g,a,b from test where a<>b and a<7 and b<7
 and floor(sqrt(a*b))=sqrt(a*b) order by g;
+------+------+------+
| g    | a    | b    |
+------+------+------+
|    4 |    1 |    4 |
|    4 |    4 |    1 |
+------+------+------+
2 rows in set (0.00 sec)


Я ленивей :-P Правда, лишних 14 значений вбил, ибо не сразу врубился про школьников. Использован MySQL 4.1.
Subscribe
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 18 comments