About the design of database tables

Source: Internet
Author: User
Keywords mysql sql oracle sqlserver php

My project needs to import the crawled Coursera data into the database for future work, such as PHP
Now that the data has been crawled, the format exists in the folder, the picture belongs to a directory, I am a data rookie, do not know how to design a database to the correct existence of the data in MySQL? (using navicat), I hope you master Liberal enlighten, younger brother grateful!

Reply content:

My project needs to import the crawled Coursera data into the database for future work, such as PHP
Now that the data has been crawled, the format exists in the folder, the picture belongs to a directory, I am a data rookie, do not know how to design a database to the correct existence of the data in MySQL? (using navicat), I hope you master Liberal enlighten, younger brother grateful!

Quite simply, you need to keep the classes and catalogs separate, and I'll give you an 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. ");    

Foreign key is to let you see clearly the relationship between the table, not necessarily have.

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 Number
PID Course parent Node number
Name Class name
Desc Lesson Information
URL Course URL
...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.