Programmer Question
Hi guys,
Having briefly studied databases in college, I haven't worked with them since and have drawn a bit of a blank, so I was wondering if someone could help me out. I have a database called Convert, which holds the following tables:
**File**
ID int PK
ISBN nvarchar(MAX)
UserName nvarchar(50)
CoverID
PDFID
**PDF**
PDFID int PK
FileContent image
MimeType nvarchar
FileName nvarchar
**Cover**
CoverID int PK
FileContent image
MimeType nvarchar
FileName nvarchar
I've just drawn a blank on two things really.
Relationships. I think if I a sql query such as below I will create foreign keys:
Alter TABLE Cover ADD FOREIGN KEY (CoverID) REFERENCES File (CoverID)
What I need to do is create one to one relationships --> One File will have one Cover, and one PDF.
The second is thing I'm having difficulty getting my head around again is the insert statements. Any advice on how I should handle those would be appreciated?
I'm using SQL Server 2008 Also.
Find the answer here
No comments:
Post a Comment