As I read here If I want to insert into a table from another in PostgreSQL database I have to use this:
This query inserts some rows from another table
INSERT INTO books (id, title, author_id, subject_id)
SELECT nextval('book_ids'), title, author_id, subject_id
FROM book_queue WHERE approved;
But how can I insert a row with more columns with my custom data(default or non default)?
E.g., books (id, title, author_id, <a cell with my data1>,subject_id,<a cell with my data2>)
And how can I update a selected data before inserting into a table?
I.e., something like:
INSERT INTO books (id, title, author_id, subject_id)
SELECT nextval('book_ids'), title, author_id+1, subject_id/2
FROM book_queue WHERE approved;
<a cell with my dataX>? Is that a row from some other table? Some other well-defined data? The way you phrase your question you will not get a proper answer; please provide more details.