Hi guys,
I'm building a small asp.net application about montlhy expenses. I was given a bit of guidance in this thread https://www.daniweb.com/web-development/aspnet/threads/488532/building-monthly-expenses-application about how to organise the database. The situation currently is this. I have 2 tables in the same database, table "expenses" and "expenseCodes". The first contains the following data:
-id (int, primary key)
-Date (date)
-ExpenseTypes (int)
-Cost (decimal)
-Comment (nvarchar)
The second:
-id (int, primary key)
-ExpenseType (nvarchar)
So, the idea is that in the first table the expenseTypes contains int values and those values correspond to the ids that I keep in the second table: for example, say that 1 in "expenses" corresponds to foodTransaction, 2 = billTransaction, 3 = rentTransaction etc, then would it be OK if I set the ExpenseType as a foreign key in the second table (but the primary key in the first table is the ID)? Or should the foreign key be id in the second table?