Interview Answer

Its OK to figure out murder mysteries, but you shouldn't need to figure out code. You should be able to read it. Steve McConnell

Create table from another table and data

January 1, 1970 12:00 am

Comments



Create table from another table and data



												desc HR.employees;
												
												Name           Null     Type         
												-------------- -------- ------------ 
												EMPLOYEE_ID    NOT NULL 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)   
												

The following query select the records from HR.employees table and create the table based on HR.employees table structure and result set.


Solution

   					 
												CREATE TABLE suppliers
												AS (SELECT *
													FROM HR.employees);
												   
												select data from newly created table.
												select * from suppliers;
																    

Comments



Please login to add comments.