Chapter - 10 Working With Multiple Tables Class X It
Chapter - 10 Working With Multiple Tables Class X It
1. Avoids repetition: When tables are linked, the same data doesn't need to be entered
in many places. For example, if a student’s information is stored in one table, we
don’t need to write the same student details again in another table; we can simply link
to it.
2. Keeps data accurate: By linking tables, we can make sure that if something changes
(like a student’s phone number), we only need to change it in one place, and it
automatically stays updated everywhere else.
In a database, we avoid repeating the same information by linking tables instead of writing
the same data in multiple places. For example:
Without linking: If a library has a table for books, and we write the author’s name
next to every book they’ve written, we might end up repeating the author’s name
many times.
With linking: We can put the author’s information in one table and just link it to the
books. This way, if the author changes their name, we only need to update it in one
place.
Referential integrity is like a rule that keeps data connected correctly. It ensures that when
you link tables, the links make sense. For example, if a student is enrolled in a course,
referential integrity makes sure that the student actually exists in the student table.
Who maintains it? The database software (like MySQL or LibreOffice Base) makes sure
this rule is followed automatically.
Q4. Difference between one-to-one and one-to-many relationships:
One-to-one relationship: In this, each item in one table is linked to only one item in
another table.
o Example: A student and their locker. Each student has one locker, and each
locker belongs to one student.
One-to-many relationship: Here, one item in a table is linked to many items in
another table.
o Example: A teacher and their students. One teacher can have many students,
but each student has only one teacher (for that class).
In a many-to-many relationship, multiple items in one table can be linked to multiple items
in another table.
Example: Think of students and subjects. Each student can study many subjects, and
each subject can have many students. To keep track of this, we use a special linking
table. This linking table has information like:
o Which students are taking which subjects.
o Which subjects are taken by which students.
For example: