Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > General > Database Concepts & Design > Design Question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-28-02, 09:56
s.selland s.selland is offline
Registered User
 
Join Date: Feb 2002
Posts: 10
Post Design Question

Hi

I am in the process of designing a database for a simple Content Management System (CMS) and I've run in to some problems.

First of all, the purpose of the CMS is to keep track of a set of different articles whose content and layout are different from each other. For example there are news articles and articles describing the employees of a company.
A news article will have a heading, a text, and two pictures ( It can not have more than two pictures), while the employee description will have employee name, personal statement and one picture.
There are several other predefined layouts but these two will do for illustrating my problem.

The tables (somewhat amputated) for articles and employees are:

Articles(articleID, name, description, pic1ID, pic2ID, text)
Employees(EmployeeID, firstname, lastname, picID, statement)

My problem is to keep track of pictures on the web server.
Before a picture can be used in an article, it must be uploaded to the server and registered (happens automatically) in the database. The table for uploaded pictures is:

Pictures(pictID , picname, alttag, picdescrib, picURL)

A picture may be used by many articles, employee descriptions etc, so we have M:N relationship between the picture table and all of its users (eg articles and employees).

I do not want the web server to be overloaded with pictures from articles that have been deleted, thus I would like to be able to list all pictures that are currently not used by any articles/employee descriptions.
So I guess I need a table that records the relationship between pictures and articles/employee description, but I cann't come up with a proper solution.


Any help or clues to a solution to this problem will be higly apreciated

Cheers

Stian Selland
Reply With Quote
  #2 (permalink)  
Old 02-28-02, 16:04
Jonte Jonte is offline
Registered User
 
Join Date: Feb 2002
Location: Sweden
Posts: 34
I think you got all the information you need in your db.

Following code lists all idīs from the picture table that donīt have an corresponding id in the Employees table.

select p.picid from pictures p
left join Employees e on (p.picid = e.picid)
where e.picid is null

the query can be modified to return all the information you need.

Hope it helps!
__________________
- Jonte
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On