I have a quick question. I have a table users
-----------------------------
| ID | first_name | last_name |
-----------------------------
and another table like users.login
------------------
| users_ID | EMAIL |
------------------
My id's in the first table are auto incrementing from a certain point, say 160,000. How do I take the id from the first table, save it to a value, and then put that value into the id of the 2nd table? The id in users.login is foreign key to users.id.
So far i have
INSERT INTO public.users (first_name, last_name)
VALUEs ($1,$2) RETURNING ID;
INSERT INTO public.users_login(email, ID)
Values($1, id)
does this work? I'm new to postgres.