I am new to database design. I am trying to create two tables which are linked by 'name' from A table and 'Aname' from table B. But what i want to do is creating a new increment int column 'id' as a representation for 'name' in A table and then add a new column in B called 'Aid' which is the foreign key.
My idea is to first (SQL SERVER)
SELECT row_number() over(order by A.name) id, A.* from A;
But how can I link this id to 'Aid' in B table?
Or if there is any existing statements for this question?
Thank you!