+ Reply to Thread
Results 1 to 3 of 3

Thread: Database Schema Inquiry

  1. #1

    Database Schema Inquiry

    i am a student and i have a question about database schema , i already created the Entity Relationship Diagram [ERD] and in this step i should do the database schema , must all the entities on my database has a relation between them and the other entities ? i.e : each entity should have a foreign key for the entity before it , because i can create all the tables and only 2 tables can have a relation between them and i control the other tables using C# program i am going to create .

    ** in my ERD all the entities have a relation between each other .

  2. #2
    Any time you create tables in the database if there is a relationship between the information in the tables then you should create a relationship to make sure that when the data is entered into the tables that the reference data will be there. This will enforce referential integrity. For example:
    Employees Database:
       pk EmployeeID
       fk SalaryID
       pk LoginID
       fk EmployeeID
       pk SalaryID
    So what this would do is make sure that if you add a salary to an employee it has to exist in the Salary table and if you added a login then you would have to have an employee to reference. It's just an added layer of security to make sure that the data that is being input into the database is valid and can be used.

    While you can technically control this with C# or whatever programing language you want it's easy to forget these little rule especially in a database that has like 200 tables or more. So getting in the habit of using relationships and maintaining referential integrity is a very good thing to do.
    Last edited by r.vector; 01-07-2012 at 04:08 AM.

  3. #3
    I got it now , i just got a problem with relationships but now it it clear to me thanks to you .

+ Reply to Thread

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts