0

I have table alpha with two columns

id   school_name

I have another table beta which has around 600 rows of data with following columns

id  school_name    school_state school_city

now i want to select school_name from beta and insert it into alpha

something like

insert into alpha (school_name) values(select school_name from beta )

but for all data ,I know it can be done with procedures but pgsql doesn't support procedures unlike mysql ,so how to achieve it?

1 Answer 1

1

The INSERT INTO ... SELECT syntax does not use a VALUES clause. Fix your syntax slightly, and your query should work:

INSERT INTO alpha (school_name)
SELECT school_name
FROM beta;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.