Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relational DB

Status
Not open for further replies.

CliffLandin

Programmer
Nov 14, 2004
81
US
I am quite new to relational database programming and I have a quick question.I have created a table that contains job information. The main id is the jobid which is SERIAL. I also have a table that contains photos for each job. They are associated with the job by the jobid.

My question is "If I delete a job, does the jobid for jobs after the deleted job in the table stay the same?"

In other words,"Will the photos for job 6 still be associated with job 6 after I delete job 3?"

I know this is pretty basic, but I just don't want to put a bunch of work into this to have to change it.

When in doubt, go flat out!

 
if you execute DELETE FROM jobs WHERE jobid = 3
only the rows with jobid = 3 are delete, and no other modifications are made to the table (except if you have defined triggers, or rules)

you can see the idea behind FOREIGN KEYS so the the pictures for the job are deleted either (which is different from the question)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top