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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!