Write Sql Statement Adds Column Zip Table Student1 Property Zip Column Table Student Q37123681

write a sql statement that adds a column ZIP to table STUDENT1,which has the same property as that of the ZIP column in tableSTUDENT


Solution


Dear Student ,

As per the requirement submitted above , kindly find the belowsolution.

SQL Query toadd column ZIP in STUDENT1 table :

Alter table STUDENT1 Add column ZIP int not null;

SQL Query tocopy data from STUDENT to STUDENT1 for ZIP column:

Update STUDENT1 set zip=(select zip from STUDENT whereSTUDENT.Id=STUDENT1.id);

Here Id is primary key column for both the tables.

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THESOLUTION.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.