почему таблица дает вывод, как это? - PullRequest
0 голосов
/ 22 сентября 2019

Я устанавливал mcq вопросник для онлайн-теста.Таким образом, таблица для хранения вопроса и опций имеет следующие поля:

question_id -PRIMARY KEY ,question_description varchar(1000),option_a -varchar(100),option_b -varchar(100) ,option_c -varchar(100),option_d -varchar(100),answer -(int)

Вопрос, который я пытаюсь задать, -

Q) a and b volumes of solutions of concentration x% and y% respectively  by volume are mixed to form a new solution of resultant concentration z%. If it is known that z is less than the average of x and y, then:
1) a>b if x>y   2) a>b if x<y  3) a<b if x>=y  4) a<b if x<y 

, поэтому, когда я вставляю его в таблицуварианты не приходят должным образом.Это происходит так:

Q) a and b volumes of solutions of concentration x% and y% respectively by volume are mixed to form a new solution of resultant concentration z%. If it is known that z is less than the average of x and y, then:

1) a>b if x>y 2) a>b if x 3) a=y 4) a

Почему идет такой вывод?

1) a> b, если x> y

2) a> b, если x 3) a = y

4) a

ВставкаВыражение было таким:

INSERT INTO table_name(question_description,option_a,option_b,option_c,option_d,answer)
VALUES('Q) a and b volumes of solutions of concentration x% and y% respectively by volume are mixed to form a new solution of resultant concentration z%. If it is known that z is less than the average of x and y, then:','a>b if x>y   ','a>b if x<y  ','a<b if x>=y  ','a<b if x<y  ','1');

, а оператор select - таким (это был вопрос номер 5)

SELECT * from table_name WHERE  question_id = '5';

1 Ответ

1 голос
/ 22 сентября 2019

Не знаю, но дано

drop table if exists t;
create table t
(question_id int PRIMARY KEY ,
question_description varchar(1000),
option_a varchar(100),
option_b varchar(100) ,
option_c varchar(100),
option_d varchar(100),
answer int
);
insert into t values
(
1,
'a and b volumes of solutions of concentration x% and y% respectively  by volume are mixed to form a new solution of resultant concentration z%. If it is known that z is less than the average of x and y, then:',
'a>b if x>y',
'a>b if x<y',
'a<b if x>=y',
'a<b if x<y',
null
) 

select * from t;

+-------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+------------+-------------+------------+--------+
| question_id | question_description                                                                                                                                                                                             | option_a   | option_b   | option_c    | option_d   | answer |
+-------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+------------+-------------+------------+--------+
|           1 | a and b volumes of solutions of concentration x% and y% respectively  by volume are mixed to form a new solution of resultant concentration z%. If it is known that z is less than the average of x and y, then: | a>b if x>y | a>b if x<y | a<b if x>=y | a<b if x<y |   NULL |
+-------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+------------+-------------+------------+--------+
1 row in set (0.00 sec)

Как и ожидалось.Если вы делаете что-то другое, вы должны сообщить нам.

...