For this question you will create two tables. Create the first table called pers
ID: 3837132 • Letter: F
Question
For this question you will create two tables. Create the first table called person_dtls with columns for customer_id, last_name, first_name.date_of_birth using the appropriate datatypes and lengths.
1) The PRIMARY KEY for this table is a composite key composed of customer_id and last_name (if they change their last name they get a new customer_id.) You don't have to load any data into this table.
The second table is called provider. It consists of customer_id, last_name (of the customer),provider (the name of the insurance company) and date_of_coverage.
2) The PRIMARY KEY for this table is a composite key composed of customer_id and provider since people can have more than one insurance company.
The FOREIGN KEY for this table references the PRIMARY KEY for the person_dtls table. You don't have to load any data into this table.
Explanation / Answer
Hi as per your needs i have made the following tables.
Please check and if any queries, feel free to ask.
create table person_dtls(
customer_id int,
last_name varchar(50),
first_name varchar(50),
date_of_birth DATE,
PRIMARY KEY (customer_id,last_name)
);
create table provider(
customer_id int,
last_name varchar(50),
provider varchar(50),
date_of_coverage DATE,
PRIMARY KEY (customer_id,provider)
REFERENCES person_dtls(customer_id,last_name)
);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.