Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
how do i integrate the contents of one table into another in mysql?
I have a site that runs on wordpress. I changed hosts recently so i had to do a database restore into the new host. However i noticed that some of the tables haven't been restored properly. I want to know if there is a way in which i can restore those specific tables without overwriting data. (just insert what has been missed). I am a complete newbie in this matter. Someone please help.
3 Answers
- 1 decade agoFavorite Answer
If some of your tables have relation between each other, then the backup file could not restore properly. Then you must copy the create and insert SQL from your backup file and execute it separately. But remember it, you must execute the SQL for first table which is parent and then child step by step.
- ?Lv 45 years ago
the quick answer is that to insert right into a table, you may desire to first understand the values you opt for to insert (aside from motor vehicle-increment accepted keys). so which you will desire to renowned the fee of Stud_course. The longer answer is that your table shape sounds unsuitable. A column talked approximately as Stud_course interior the direction table set off off a huge purple flag in my suggestions. i anticipate you're doing the common direction enrollment variety of homework concern. it quite is consumer-friendly to start, you probable have already got this area: you opt for a table for college young ones, and additionally you opt for a table for courses, and each and each table would desire to, of direction, have a accepted key (maximum possibly of the motor vehicle-increment style). yet then you get to the extra stable area: a thank you to music which pupils are in each and each direction, and the thank you to music which courses a student is taking. There are 2 MANY-TO-MANY relationships going on right here: each and each direction could have MANY pupils. each and each student can take MANY courses. once you run into this, you may desire to function a three'rd table. A table that maps courses to pupils. you may call this table Stud_course. (See how I in basic terms switched over your column call to a table call?) Your Stud_course table quite in basic terms desires 2 columns: course_id student_id course_id is a foreign places key to the identity column on your direction table. student_id is a foreign places key to the identity column on your student table. With those 3 tables, you may easily answer the common questions with a three table connect: What pupils are taking direction 123? choose stuff FROM direction connect Stud_course employing(course_id) connect student employing(student_id) the place course_id = 123; What courses is student 456 taking? choose stuff FROM student connect Stud_course employing(student_id) connect direction employing(course_id) the place student_id = 456; And enrolling a student in a direction is as elementary as: INSERT INTO Stud_course(student_id,course_id) VALUES ( $stud_id, $course_id);