I am creating a database in postgreSQL
I have two tables, one containing details about a house and another for each room in the house. The house_id is set up using house_id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY
I want the room_id to be 1, 2, .. n for n rooms in the house. Which starts at 1 again for a new house_id.
This mean I have to combine these two identifiers somehow, and create a sequence for room_id which only counts upwards for a new house_id.
Is this possible in postgreSQL? Or should I settle for a room_id integer where I basically check the max room_id for each house_id and add one to it to form the
new room_id
