Knowee
Questions
Features
Study Tools

Which of the following statements can be used to add a new primary key to an existing table that has no primary key?  *1 pointADD PRIMARY KEY TO TABLE table_name(column_name)ALTER TABLE table_name ADD CONSTRAINT PRIMARY KEY(column_name)ALTER TABLE table_name ADD PRIMARY KEY(column_name)ADD PRIMARY KEY (column_name) TO table_name

Question

Which of the following statements can be used to add a new primary key to an existing table that has no primary key?  *1 pointADD PRIMARY KEY TO TABLE table_name(column_name)ALTER TABLE table_name ADD CONSTRAINT PRIMARY KEY(column_name)ALTER TABLE table_name ADD PRIMARY KEY(column_name)ADD PRIMARY KEY (column_name) TO table_name

🧐 Not the exact question you are looking for?Go ask a question

Solution

The correct statement to add a new primary key to an existing table that has no primary key is:

ALTER TABLE table_name ADD PRIMARY KEY(column_name)

Similar Questions

In data definition language (DDL), which of the following statements can be used to add a primary key to a table?CREATE TABLE Artists ADD 'artist_pk' AS PRIMARY KEY (artistID)ADD CONSTRAINT 'artist_pk' PRIMARY KEY (artistID) ALTER TABLE Artists PRIMARY KEY (artistID)ALTER TABLE Artists ADD PRIMARY KEY (artist_pk);

What SQL command is used to add a primary key to an existing table?OptionsCHANGE TABLEALTER TABLEADD PRIMARY KEYMODIFY TABLE

Create Table SALE(        SaleID integer,        SaleDate date,        Tax decimal,        Total decimal);Create Table ITEM(        ItemID integer,        Name char(30),        Cost decimal,        Price decimal);Create Table SALE_ITEM(        SaleID integer,        SaleItemID integer);Considering the SQL create statements; assume that SALE, SALE_ITEM and ITEM tables were created without Primary Keys and Foreign Keys.  Which of the following SQL statements gives an error?Question 12Select one:a.Alter Table SALE Add Primary Key (SaleID);Alter Table SALE_ITEM Add Primary Key (SaleID);Alter Table SALE Add Foreign Key (SaleID) References SALE_ITEM;b.Alter Table SALE Add Primary Key (SaleID);Alter Table SALE_ITEM Add Primary Key (SaleID, SaleItemID);Alter Table SALE_ITEM Add Unique (SaleID);Alter Table SALE Add Foreign Key (SaleID) References SALE_ITEM (SaleID);c.Alter Table SALE Add Primary Key (SaleID);Alter Table SALE_ITEM Add Primary Key (SaleID, SaleItemID);Alter Table SALE_ITEM Add Unique (SaleID);Alter Table ITEM Add Primary Key (ItemID);Alter Table SALE Add Foreign Key (SaleID) References SALE_ITEM;d.Alter Table ITEM Add Primary Key (ItemID);Alter Table SALE_ITEM Add Primary Key (SaleID, SaleItemID);Alter Table SALE_ITEM Add Unique (SaleID);Alter Table ITEM Add Foreign Key (ItemID) References SALE_ITEM;

Which constraint must a primary key adhere to

Which of the statement(S) are incorrect w.r.t primary key in SQL. A. A primary key can contain duplicate values to ensure redundancy.B. A primary key can be a composite key, consisting of multiple columns.C. A primary key must be an auto-increment field.D. A primary key cannot be null

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.