Interview Answer

Measuring programming progress by lines of code is like measuring aircraft building progress by weight. Bill Gates

add, modify, drop column in the table

January 1, 1970 12:00 am

Comments



add, modify, drop column in the table



												desc suppliers

												Name           Null     Type         
												-------------- -------- ------------ 
												EMPLOYEE_ID             NUMBER(6)    
												FIRST_NAME              VARCHAR2(20) 
												LAST_NAME      NOT NULL VARCHAR2(25) 
												EMAIL          NOT NULL VARCHAR2(25) 
												PHONE_NUMBER            VARCHAR2(20) 
												HIRE_DATE      NOT NULL DATE         
												JOB_ID         NOT NULL VARCHAR2(10) 
												SALARY                  NUMBER(8,2)  
												COMMISSION_PCT          NUMBER(2,2)  
												MANAGER_ID              NUMBER(6)    
												DEPARTMENT_ID           NUMBER(4)  

												

Solution

   					 
												
												ALTER TABLE suppliers ADD supply_date DATE;
												ALTER TABLE suppliers ADD fullname VARCHAR(20);
												ALTER TABLE suppliers MODIFY ( fullname VARCHAR(150) );
												ALTER TABLE suppliers RENAME COLUMN fullname TO fname;

												Table SUPPLIERS altered.

												Table SUPPLIERS altered.

												Table SUPPLIERS altered.

												Table SUPPLIERS altered.

												Name           Null     Type          
												-------------- -------- ------------- 
												EMPLOYEE_ID             NUMBER(6)     
												FIRST_NAME              VARCHAR2(20)  
												LAST_NAME      NOT NULL VARCHAR2(25)  
												EMAIL          NOT NULL VARCHAR2(25)  
												PHONE_NUMBER            VARCHAR2(20)  
												HIRE_DATE      NOT NULL DATE          
												JOB_ID         NOT NULL VARCHAR2(10)  
												SALARY                  NUMBER(8,2)   
												COMMISSION_PCT          NUMBER(2,2)   
												MANAGER_ID              NUMBER(6)     
												DEPARTMENT_ID           NUMBER(4)     
												SUPPLY_DATE             DATE          
												FNAME                   VARCHAR2(150) 

												ALTER TABLE suppliers DROP COLUMN fname;
																    

Comments



Please login to add comments.