I am having difficulty creating an INSERT query.
Employee_record table has column manager_id and manager_name
Node table has column manager_id
I want to insert manager_name in Node table.
How to achieve this?
CodePudding user response:
alter you node table alter table node add manager_name varchar2(90); then use this insert query if you have to insert only manager name insert into node (manager_name) select manager_name from Employee_record where manager_id = ?
pass id at ?
CodePudding user response:
if you just want to add a new column to the table:
ALTER TABLE node
ADD COLUMN manager_name VARCHAR(255);
you dont have to use specifically 255, thats just a standard ive come to use.
then if you want to add the same records from the manager_name column from the employee_record table into the newly created manager_name column in the node table:
INSERT INTO node(manager_name)
SELECT manager_name
FROM employee_record
WHERE *conditions*
for conditions, you can specify if you only want certain names to be inserted, such as WHERE manager_id = 12345.
However, as some of the comments have said, doing this will just make two identical tables which doesn't seem have much use from what i can tell about the situation.