My project needs to import the crawled coursera data to the database for future use. For example, php and other data have been crawled. The format is in a folder and the image is in a directory, I am a data cainiao. I don't know how to design a database...
My project needs to import the crawled coursera data to the database for future use, such as php.
Now that the data has been crawled, the format exists in the folder. The picture shows a directory. I am a data rookie, I don't know how to design a database so that these data levels can be correctly stored in mysql? (Using navicat). I hope you will be grateful to me!
Reply content:
My project needs to import the crawled coursera data to the database for future use, such as php.
Now that the data has been crawled, the format exists in the folder. The picture shows a directory. I am a data rookie, I don't know how to design a database so that these data levels can be correctly stored in mysql? (Using navicat). I hope you will be grateful to me!
It's easy. You need to save the course and the Directory separately. For example:
create table course( id int not null auto_increment, course_name varchar(32), url varchar(64), category_id int, course_desc varchar(512), primary key (id), foreign key (category_id) references category(id) on delete cascade);create table category( id int not null auto_increment, category_name varchar(32), parent_id int, primary key (id), foreign key (parent_id) references category(id) on delete cascade); insert into category(id, category_name, parent_id)values (1, "Computer science", null), (2, "Algorithms", 1), (3, "Design & Product", 1), (4, "Software development", 1);insert into course(id, course_name, url, category_id, course_desc)values (1, "Software Engineering Management", "https://course.scut.cn/sem", 4,"Software engineering management could be described simply as a management position in the software industry. ");
The foreign key is used to show you the relationship between tables, not necessarily.
mysql> select * from course \G*************************** 1. row *************************** id: 1course_name: Software Engineering Management url: https://course.scut.cn/semcategory_id: 4course_desc: Software engineering management could be described simply as a management position in the software industry. 1 row in set (0.00 sec)mysql> select * from category;+----+----------------------+-----------+| id | category_name | parent_id |+----+----------------------+-----------+| 1 | Computer science | NULL || 2 | Algorithms | 1 || 3 | Design & Product | 1 || 4 | Software development | 1 |+----+----------------------+-----------+4 rows in set (0.00 sec)
Id: course No.
Pid course parent node No.
Name Course name
Desc course information
Url course url
...