Question
10-3) Please help answer a) and b) below. Test1 CREATE TABLE Test1 (name VARCHAR(20), ssn CHAR(9), dept_number INTEGER, acct_balance NUMERIC(9,2)); -- insert values into table
10-3) Please help answer a) and b) below.
Test1
CREATE TABLE Test1 (name VARCHAR(20), ssn CHAR(9), dept_number INTEGER, acct_balance NUMERIC(9,2));
-- insert values into table Insert into Test1 values('xx','yy',2,5); Insert into Test1 values('xx','yyy',2000000000,5); Insert into Test1 values('xx','yyyy',2,1234567.89);
a) Recreate Test1, which does not specify a primary key.
Populate the table with at least one duplicate ssn. Then, try to impose the PRIMARY KEY
constraint with an ALTER TABLE command. What happens? failed.
b) Recreate the Test1 table, but this time add a primary key of ssn. If you still have
the Test1 table from Exercise a0 above, you may be able to delete offending rows and add the PRIMARY
KEY constraint. Enter two more rows to your table - one containing a new ssn and one with a
duplicate ssn. What happens?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started