Click here to Skip to main content
15,878,852 members
Home / Discussions / Database
   

Database

 
GeneralRe: Protect my sql server database Pin
dilkonika24-Sep-14 13:30
dilkonika24-Sep-14 13:30 
GeneralRe: Protect my sql server database Pin
Eddy Vluggen25-Sep-14 1:53
professionalEddy Vluggen25-Sep-14 1:53 
AnswerRe: Protect my sql server database Pin
Corporal Agarn24-Sep-14 4:33
professionalCorporal Agarn24-Sep-14 4:33 
GeneralRe: Protect my sql server database Pin
dilkonika24-Sep-14 6:18
dilkonika24-Sep-14 6:18 
AnswerRe: Protect my sql server database Pin
data modeling guy29-Sep-14 6:58
data modeling guy29-Sep-14 6:58 
AnswerRe: Protect my sql server database Pin
Wendelius30-Sep-14 8:59
mentorWendelius30-Sep-14 8:59 
QuestionSQL Server : Multiple relationship for the same field Pin
dilkonika23-Sep-14 7:29
dilkonika23-Sep-14 7:29 
AnswerRe: SQL Server : Multiple relationship for the same field Pin
Wendelius23-Sep-14 8:04
mentorWendelius23-Sep-14 8:04 
If I understood your question correctly you would use the same field (item_id) for two separate purposes. If that's correct, in my opinion you have something wrong with the database model.

Concerning your example I'd suggest something like:
Product
-------
- Id
- name
- category
- IsService
- nr
- value


Sell_item
---------
- Id
- product (former item_id), foreign key to Product
- quantity
- price
- value

The product table would hold all sell able items and the fields are a combination from your both former tables.

Also I wouldn't store the value (at least not as a normal column) since it can always be calculated from quantity times price.
GeneralRe: SQL Server : Multiple relationship for the same field Pin
dilkonika23-Sep-14 8:14
dilkonika23-Sep-14 8:14 
AnswerRe: SQL Server : Multiple relationship for the same field Pin
Wendelius23-Sep-14 8:33
mentorWendelius23-Sep-14 8:33 
AnswerRe: SQL Server : Multiple relationship for the same field Pin
Mycroft Holmes23-Sep-14 14:19
professionalMycroft Holmes23-Sep-14 14:19 
AnswerRe: SQL Server : Multiple relationship for the same field Pin
data modeling guy29-Sep-14 5:02
data modeling guy29-Sep-14 5:02 
QuestionAdd primary Key as GUID automatic generation Pin
MrKBA22-Sep-14 21:31
MrKBA22-Sep-14 21:31 
AnswerRe: Add primary Key as GUID automatic generation Pin
Kornfeld Eliyahu Peter22-Sep-14 22:00
professionalKornfeld Eliyahu Peter22-Sep-14 22:00 
GeneralRe: Add primary Key as GUID automatic generation Pin
MrKBA22-Sep-14 22:52
MrKBA22-Sep-14 22:52 
JokeRe: Add primary Key as GUID automatic generation Pin
Kornfeld Eliyahu Peter22-Sep-14 23:08
professionalKornfeld Eliyahu Peter22-Sep-14 23:08 
GeneralRe: Add primary Key as GUID automatic generation Pin
MrKBA22-Sep-14 23:40
MrKBA22-Sep-14 23:40 
JokeRe: Add primary Key as GUID automatic generation Pin
Kornfeld Eliyahu Peter22-Sep-14 23:42
professionalKornfeld Eliyahu Peter22-Sep-14 23:42 
GeneralRe: Add primary Key as GUID automatic generation Pin
MrKBA23-Sep-14 0:01
MrKBA23-Sep-14 0:01 
JokeRe: Add primary Key as GUID automatic generation Pin
Kornfeld Eliyahu Peter23-Sep-14 0:02
professionalKornfeld Eliyahu Peter23-Sep-14 0:02 
GeneralRe: Add primary Key as GUID automatic generation Pin
Estys23-Sep-14 0:24
Estys23-Sep-14 0:24 
GeneralRe: Add primary Key as GUID automatic generation Pin
MrKBA24-Sep-14 4:16
MrKBA24-Sep-14 4:16 
AnswerRe: Add primary Key as GUID automatic generation Pin
jschell23-Sep-14 12:01
jschell23-Sep-14 12:01 
AnswerRe: Add primary Key as GUID automatic generation Pin
Bernhard Hiller23-Sep-14 22:19
Bernhard Hiller23-Sep-14 22:19 
GeneralRe: Add primary Key as GUID automatic generation Pin
MrKBA24-Sep-14 22:04
MrKBA24-Sep-14 22:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.