Question

In: Computer Science

Describe how foreign keys impact the ability to add or delete rows from a table or...

Describe how foreign keys impact the ability to add or delete rows from a table or the ability to drop tables from a database schema.

Solutions

Expert Solution

Foreign keys is nothing but the primary key of a table that is used in another table.Let's take two table one is "STUDENT" and other one as "FEE_DETAIL" . Let the primary key of "STUDENT" table is "STUDENT_ID" and the attribute "STUDENT_ID" is also used in the table "FEE_DETAIL" (so that it can store the detail of fees for each student with the help of student id) Now as it is used in table "FEE_DETAIL" so the "STUDENT_ID" is foreign key for the table "FEE_DETAIL".

Now let's add a tuple or row or entry in table "FEE_DETAIL"(which include student_id, and other fee details) But this may create a problem because suppose you added a entry of student with student_id as 12 (let) but it may be possible that there is no student exist with student_id=12(it may there is no entry of student with student_id=12 in table "STUDENT").So we only can add those record in foreign key which is already exists in the table from where it belong.

In same way let's suppose we have deleted an entry of student with student_id= 101 from table "STUDENT" .But it is still exists in "FEE_DETAIL".Then in this case it will become meaningless.

So to drop a table we must first delete all records that is related to that table means first we need to delete all foreign keys records related to that table then only we can drop a table.


Related Solutions

1. Write CREATE TABLE statements for the following tables (foreign keys are in italic and bold)....
1. Write CREATE TABLE statements for the following tables (foreign keys are in italic and bold). Make sure you have all needed constraints and appropriate datatypes for attributes: Student (stID, stName, dateOfBirth, advID, majorName, GPA) Advisor (advID, advName, specialty) 2.  Insert several records in each table.
1-Describe the decision making process to add or delete products, services or departments. 2-Describe and defend...
1-Describe the decision making process to add or delete products, services or departments. 2-Describe and defend the relevance or irrelevance of book value in the decision to replace equipment. 3-Is the gain or loss on disposal of equipment a taxable event to the organization?
Step 2: Create Stored Procedures to Add/Update/Delete an entity table Create a script to create a...
Step 2: Create Stored Procedures to Add/Update/Delete an entity table Create a script to create a table named ProjectBilling which will have the following columns: • projectBillID char(6) : A 6 character unique identifier (numbers and letters) • TransAmount decimal(16,9) : The amount of the transaction • TransDesc varchar(255): A description of the transaction • TransDate datetime: The date of the transaction • projectID char(4):The Id of the project • accountMgr char(8):The employee who manages the bill ledger Include this...
Consider the following three tables, primary and foreign keys. Table Name        SalesPeople Attribute Name                  &nbsp
Consider the following three tables, primary and foreign keys. Table Name        SalesPeople Attribute Name                                Type                                      Key Type EmployeeNumber             Number                               Primary Key Name                                   Character JobTitle                                  Character            Address                                 Character PhoneNumber                     Character YearsInPosition                             Number Table Name        ProductDescription Attribute Name                                Type                                      Key Type                 ProductNumber                Number                               Primary Key                 ProductName                  Character                            ProductPrice                   Number Table Name        SalesOrder Attribute Name                                Type                                      Key Type                 SalesOrderNumber        Number                               Primary Key                 ProductNumber               Number                               Foreign Key                 EmployeeNumber           Number                               Foreign Key                 SalesOrderDate                Date Assume that you...
Consider and describe how interest rates and exchange rates impact foreign direct investment and foreign exchange...
Consider and describe how interest rates and exchange rates impact foreign direct investment and foreign exchange money flows. Comment on PEG, Free Floating System, etc.
Write an algorithm to delete an element from a hash table that uses linear probing as...
Write an algorithm to delete an element from a hash table that uses linear probing as its clash resolution strategy. Analyze your algorithm and show the results using order notation?
Discuss why databases are important in accounting information systems. Describe primary and foreign keys, normalization and...
Discuss why databases are important in accounting information systems. Describe primary and foreign keys, normalization and database cardinalities. Why are each important to the database design? Your initial posting should be 250-500 words and must be submitted by Thursday, 11:59 pm MST, of this week.
Discuss why databases are important in accounting information systems. Describe primary and foreign keys, normalization and...
Discuss why databases are important in accounting information systems. Describe primary and foreign keys, normalization and database cardinalities. Why are each important to the database design? Your initial posting should be 250-500 words and must be submitted by Thursday, 11:59 pm MST, of this week.
Briefly describe the impact of trauma on a person's ability to understand and for retaining information
Briefly describe the impact of trauma on a person's ability to understand and for retaining information
Describe what a Business Impact Analysis (BIA)is and create a BIA table to show how an...
Describe what a Business Impact Analysis (BIA)is and create a BIA table to show how an information security manager can use it to evaluate a Customer Relationship Management System?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT