Hi, I need your help…
In the table t_contents
stored an a database MySql version 8.0.17
I have these rows
+-------------------------+-------+-------+-----+
| Contents | sID_c | sID_p | sID |
+-------------------------+-------+-------+-----+
| Content 1 | 1 | NULL | 1 |
| - Gaio Giulio Cesare | 1 | NULL | 2 |
| Veni, vidi, vici. | 1 | NULL | 3 |
| Carpe diem. | 1 | NULL | 4 |
| Ubi maior minor cessat. | 1 | NULL | 5 |
| - Quinto Orazio Flacco | 1 | NULL | 6 |
| Condicio sine qua non. | 1 | NULL | 7 |
| Carthago delenda est. | 1 | NULL | 8 |
| Content 2 | 2 | NULL | 9 |
| - Marco Porcio Catone | 2 | NULL | 10 |
| Inter sidera versor. | 2 | NULL | 11 |
| Content 3 | 3 | NULL | 12 |
| - Marco Tullio Cicero | 3 | NULL | 13 |
| Vivere est cogitare | 3 | NULL | 14 |
+-------------------------+-------+-------+-----+
In the column Contents
of the table t_contents
:
- The
Content X
it’s aSection
- The
- Gaio Giulio Cesare
it’s aChapter
- The
Veni, vidi, vici
,Carpe diem.
andUbi maior minor cessat.
are the paragraph ofChapter
- etc…
I need update the value on column sID_p
according to this scheme, it’s possible?
+-------------------------+-------+-------+-----+
| Contents | sID_c | sID_p | sID |
+-------------------------+-------+-------+-----+
| Content 1 | 1 | 1 | 1 |
| - Gaio Giulio Cesare | 1 | 1 | 2 |
| Veni, vidi, vici. | 1 | 1.1 | 3 |
| Carpe diem. | 1 | 1.2 | 4 |
| Ubi maior minor cessat. | 1 | 1.3 | 5 |
| - Quinto Orazio Flacco | 1 | 2 | 6 |
| Condicio sine qua non. | 1 | 2.1 | 7 |
| Carthago delenda est. | 1 | 2.2 | 8 |
| Content 2 | 2 | 2 | 9 |
| - Marco Porcio Catone | 2 | 2 | 10 |
| Inter sidera versor. | 2 | 2.1 | 11 |
| Content 3 | 3 | 3 | 12 |
| - Marco Tullio Cicero | 3 | 3 | 13 |
| Vivere est cogitare | 3 | 3.1 | 14 |
+-------------------------+-------+-------+-----+
11 rows in set (0.02 sec)
The table t_contents
is registered in a remote MySql database whose structure cannot be edited because I’m not administrator but user with limited permissions…
I’m not the database designer in this case… I’m sorry… I have this and I have to work on this…
Please don’t blame me for this… better not answer me…
Any help would greatly appreciate… Thank you.
-- ----------------------------
-- Table structure for t_contents
-- ----------------------------
DROP TABLE IF EXISTS `t_contents`;
CREATE TABLE `t_contents` (
`Contents` varchar(255) DEFAULT NULL,
`sID_c` int(11) NULL DEFAULT NULL,
`sID_p` varchar(255) DEFAULT NULL,
`sID` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`sID`) USING BTREE
) ENGINE = InnoDB;
-- ----------------------------
-- Records of t_contents
-- ----------------------------
INSERT INTO `t_contents` VALUES ('Content 1', 1, NULL, 1);
INSERT INTO `t_contents` VALUES ('- Gaio Giulio Cesare', 1, NULL, 2);
INSERT INTO `t_contents` VALUES ('Veni, vidi, vici.', 1, NULL, 3);
INSERT INTO `t_contents` VALUES ('Carpe diem.', 1, NULL, 4);
INSERT INTO `t_contents` VALUES ('Ubi maior minor cessat.', 1, NULL, 5);
INSERT INTO `t_contents` VALUES ('- Quinto Orazio Flacco', 1, NULL, 6);
INSERT INTO `t_contents` VALUES ('Condicio sine qua non.', 1, NULL, 7);
INSERT INTO `t_contents` VALUES ('Carthago delenda est.', 1, NULL, 8);
INSERT INTO `t_contents` VALUES ('Content 2', 2, NULL, 9);
INSERT INTO `t_contents` VALUES ('- Marco Porcio Catone', 2, NULL, 10);
INSERT INTO `t_contents` VALUES ('Inter sidera versor.', 2, NULL, 11);
INSERT INTO `t_contents` VALUES ('Content 3', 3, NULL, 12);
INSERT INTO `t_contents` VALUES ('- Marco Tullio Cicero', 3, NULL, 13);
INSERT INTO `t_contents` VALUES ('Vivere est cogitare', 3, NULL, 14);