Questions about the time period to save to the database

Source: Internet
Author: User
We are practicing open public platform applications
We're going to take the curriculum (the HTML-formatted curriculum with table layout) and get it back from the school server.
Use PHP's split function to manipulate the string that gets back the timetable
Extract the information from each lesson and save it in the database
Use PHP to re-format a curriculum based on the number of weeks required by the user (only show a week's course the original curriculum is the whole semester in one table) the URL of the new curriculum is returned to the user

I'm in charge of database building. I'm going to build 3 tables.
form an ID number (used to request a timetable again to the school server)
Table two number of ID weeks course Name
Table Three ID course name Class week number of classes class location teacher
(For Table II and Table III, the schedule for a week is drawn by SQL query)
There's a problem here, because the week number of the original course is 1-8 weeks, that way.
What should I do to
1. In the database, only one line is represented.
2. You have to be able to do Table II and table three (when the query is only a single week to extract the course data is only a week) the effect of the corresponding week's curriculum is derived from the SQL query

It feels like there's no solution to this problem, and it's a cumbersome solution.
I'm supposed to be doing a record every week. It feels like the database will be very redundant.

Reply content:

We are practicing open public platform applications
We're going to take the curriculum (the HTML-formatted curriculum with table layout) and get it back from the school server.
Use PHP's split function to manipulate the string that gets back the timetable
Extract the information from each lesson and save it in the database
Use PHP to re-format a curriculum based on the number of weeks required by the user (only show a week's course the original curriculum is the whole semester in one table) the URL of the new curriculum is returned to the user

I'm in charge of database building. I'm going to build 3 tables.
form an ID number (used to request a timetable again to the school server)
Table two number of ID weeks course Name
Table Three ID course name Class week number of classes class location teacher
(For Table II and Table III, the schedule for a week is drawn by SQL query)
There's a problem here, because the week number of the original course is 1-8 weeks, that way.
What should I do to
1. In the database, only one line is represented.
2. You have to be able to do Table II and table three (when the query is only a single week to extract the course data is only a week) the effect of the corresponding week's curriculum is derived from the SQL query

It feels like there's no solution to this problem, and it's a cumbersome solution.
I'm supposed to be doing a record every week. It feels like the database will be very redundant.

Table 1 ID number password (encrypted with MD5 or SHA1)
Table 2 ID Course ID
Table 3 Course ID Class duration Course number of classes class location class teacher

Table 1 and table 2 Connect with ID as foreign key
Table 2 and Table 3 Connect as a foreign key to the course ID
Table 1 is a record of the person's information, table 3 is to record the course information, people and courses are many-to-many relationships, so here Table 2 is equivalent to a link table
Table 3 The advantage of saving time is that the time stamp and the number of weeks should be able to go directly, so in SQL query is actually a 7-day range of a lookup, but also in chronological order (because you output the curriculum must be ordered) and then almost no redundant data
If, in table 3, the same course appears several times a week, the course name, the class location, the class teacher may be repeating, you may consider to split a table. (But if it's not school work, I don't think I need to dismantle it ...) )

PS: Password Remember to use MD5 or SHA1 or something else encryption.

I've merged tables 2 and 3.
ID Course Name Class week number of classes The teacher starts the class week number of weeks

If a course is 1-8 weeks, in the database, two fields are started. The number of weeks to the end of the class week is 1 8

It is better to compare the number of weeks with the current number of weeks and the number of weeks before the start of the class.

It feels like I'm still dead early.

  • 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.