nicom :
I want to use MySQL as some sort of timetable and I already built an SQL Table like this:
+------+--------+---------+-----------+----------+--------+
| TIME | MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY |
+------+--------+---------+-----------+----------+--------+
| 1 | NULL | NULL | NULL | NULL | NULL |
| 2 | NULL | NULL | NULL | NULL | NULL |
| 3 | NULL | NULL | NULL | NULL | NULL |
| 4 | NULL | NULL | NULL | NULL | NULL |
| 5 | NULL | NULL | NULL | NULL | NULL |
| 6 | NULL | NULL | NULL | NULL | NULL |
| 7 | NULL | NULL | NULL | NULL | NULL |
| 8 | NULL | NULL | NULL | NULL | NULL |
| 9 | NULL | NULL | NULL | NULL | NULL |
+------+--------+---------+-----------+----------+--------+
This is what I get when using SELECT
. Now I want to insert data in a specific field.
I tried INSERT INTO timetable (MONDAY) WHERE TIME=1
but it didn't work, and after some Google research I got the information that it is not possible to use WHERE
in combination with INSERT INTO
.
Is there a way to insert data into a specific field or another way of using WHERE
?
T.Maharani :
You can use UPDATE query for updated the selected row(s).
Query:
UPDATE timetable SET monday='classes available' WHERE time=1;
Here I insert sample data 'classes available' when time=1
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=337086&siteId=1