Q.

(a) What is the use of UPDATE statement in SQL ? How is it different from ALTER statement

(b) Mr. Shankar created a table VEHICLE with 3 rows and 4 columns. He added 1 more row to it deleted one column. What is the Cardinality and Degree of the Table VEHICLE ?

(c) Consider the following table named "GYM" with details about fitness items being sold in the store. Write command of SQL for (i) to (iv).

 

(i) To display the names of all the items whose name starts with "A".

(ii) To display ICODEs and INAMEs of all items, whose Brandname is Reliable or Coscore.

(iii) To change the Brandname to "Fit Trend India" of the item, whose ICODE as "G101".

(iv) Add a new row for new item in GYM with the details :


"G107", "Vibro exerciser", 21000, "GTCFitness"



Answer =

(a)

The UPDATE statement in SQL is used to update the data of an existing table in database .
ALTER is a DDL (Data Definition Language) statement. Whereas UPDATE is a DML (Data Manipulation Language) statement. ALTER is used to update the structure of the table (add/remove field/index etc). Whereas UPDATE is used to update data.

(b)
number of cardinality = 4
Number of degree = 3

(c)

(i)
select INAME from GYM
Where INAME like  “A%”

(ii)
select ICODE , INAME from GYM
Where BRANDNAME in  ( “Reliable” , “Coscore” )

(iii)
update GYM
Set BRANDNAME = “Fit Trend India ”
Where ICODE = “G101”;

(iv)
insert into GYM values ("G107", "Vibro exerciser", 21000, "GTCFitness") ;

18 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post