Click here to Skip to main content
15,914,163 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
Dear All,

we are developing one application. we are analise database . master table relation to 15 tables. in master table in emp_no primare key, remaining tables is foregen key. am i right? in our application login in to employee based on emp_no when employee login to the application onle that employee information get from the all the tables. we are developing application in asp.net.

please give me your valuable suggation .


we are using technologies :Csharp, asp.net,badkend sqlServer 2008
Posted
Updated 10-May-12 7:24am
v2
Comments
Sergey Alexandrovich Kryukov 10-May-12 16:29pm    
What is that supposed to mean: "remaining tables is foregen key"? A table is a table, a key is a key...
Database schema depends on your application needs, among other things.
--SA

The basic idea is correct, the parent table has a primary (or unique) key defined on it and the child tables reference the parent table with a foreign key constraint. Good examples: http://www.w3schools.com/sql/sql_foreignkey.asp[^]

I didn't quite understand the other part of the question concerning login. You can create a table (user etc) to define information about the users of your applications and using that table check if the user is valid or not (correct password, username and so on).
 
Share this answer
 
Recommendation is to execute this logic at SQL level. You can write a stored procedure as:

SQL
Create Procedure FetchEmpInfo
@EmpNo Int
AS
SELECT * FROM Employee mast, reftable1 r1, reftable2 r2,....reftable15 r3
WHERE 
mast.Id IN(@Ids) AND
mast.Id = r1.Id AND
mast.Id = r2.Id AND
.....
mast.Id = r15.Id AND
 
Share this answer
 
v2
I can't understand why 1 table (master) is related with 15 tables.

I suggest to read:
Understanding databases[^]
Navigating a Relationship between tables[^]

Example database: Northwind[^] is availible to download. Please, study it.
 
Share this answer
 
Comments
Maciej Los 10-May-12 18:28pm    
Is my answer bad or something? Do i really deserve only for 1?
...
;(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900