Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Donations
Please Support Us!

Please help keep (=WDG=) alive

Donate with PayPal!
Last 100 Shouts:
January 16, 2025, 08:56:20 PM
Happy New Year!
January 27, 2024, 05:26:45 PM
Happy new year WDG
December 10, 2023, 05:52:39 PM
Hello Power!
November 24, 2023, 09:51:34 PM
Helloes! I'm here for my annual password change! How is everyone doing?
August 03, 2023, 08:42:51 PM
WDG are going to i71. All welcome. Message for more information or ask on discord
July 27, 2023, 07:35:21 PM
The WDG discord channel is up and running. Send me a message or post for details
December 08, 2022, 04:05:12 PM
Odd. Should do. Send Mode a messsage here. He should be able to pick it up and send you an invite
December 07, 2022, 11:26:55 PM
@berath link doesn?t work Sad
August 08, 2022, 09:32:46 PM
December 23, 2020, 12:34:53 PM
Spammers be gone!
September 28, 2020, 11:18:57 PM
Nice!
September 28, 2020, 09:55:06 PM
I’m in 🙌
September 28, 2020, 02:59:45 PM
Yay!!!!!! Wix is in da house
September 28, 2020, 02:55:44 PM
Hey Berath !! I made it !
September 25, 2020, 05:13:56 PM
Wix - we may have some new friends playing a new game finding their way here soon.....
July 01, 2020, 11:05:23 PM
Hello Terror. People still drop by here now and again
June 29, 2020, 02:02:45 PM
Hi guys. I hope you are all well and keeping sane and safe during these trying times (and all that).

Just FYI that mode was looking for ways to get back in touch via reddit (r/WDG).
February 24, 2020, 09:26:46 AM
Zombie TF2? Do we need to dress up?
February 19, 2020, 01:03:56 AM
I'd play zombie TF2
February 19, 2020, 12:52:19 AM
Any appetite for a TF2 revival?
February 19, 2020, 12:52:01 AM
Awesome
February 19, 2020, 12:48:30 AM
Yes this thing is still on
February 19, 2020, 12:47:16 AM
Hello! Is this thing still on?
December 26, 2019, 12:43:10 AM
Merry Christmas!!!
August 13, 2019, 07:35:11 PM
Sweeping and clearing out the cobwebs, keeping everything spruce https://gph.is/2oImD0j
March 08, 2019, 11:38:14 AM
Cheers Stu / Berath was going to happen one day Sad
March 06, 2019, 11:08:46 PM
It's officially 'not secure' according to Chrome now
March 06, 2019, 11:07:11 PM
Damn. 1&1 have upgraded their something or other but seem to have allowed for ancient forums like this to keep on
March 05, 2019, 03:37:50 PM
NuB site is no more due to a forced PHP v7 upgrade on the web host that breaks SMF/TinyPortal.
January 31, 2019, 09:50:48 AM
Sad
January 22, 2019, 11:22:09 PM
Sad nub  site down Sad bye bye

January 01, 2019, 11:43:02 AM
Happy new year.
Who Dares... Grins!!
December 30, 2018, 08:04:52 PM
no
December 29, 2018, 12:05:55 PM
MEssaage me
for a free steam key for faeria
December 25, 2018, 02:35:39 PM
merry xmas wdg
December 23, 2018, 11:34:33 AM
Hello Milli!
December 21, 2018, 10:55:25 PM
Hello WDG!
December 13, 2018, 10:51:13 PM
I still pop by to give the old place a dusting and clear out
November 09, 2018, 03:36:17 PM
The shoutbox has actually had shouts in it recently? Impossible.
November 08, 2018, 07:45:58 PM
:dohjan: :newkid:
November 06, 2018, 07:11:48 PM
Enjoy!
November 05, 2018, 11:49:05 PM
Just poking about
June 02, 2018, 12:56:39 PM
Goodness me, so it does!
May 22, 2018, 03:38:35 PM
this site needs a shout in 2018 Smiley
November 16, 2017, 08:08:43 PM
Spam removed. Thank you muchly Hulinut
October 15, 2017, 06:02:47 PM
Yay, been fixed!
October 14, 2017, 07:08:12 PM
I'm trying to get the mumble server up again
October 11, 2017, 06:23:26 PM
Orange Box 10 years old wow
June 18, 2017, 09:46:41 PM
Fluffy!
June 14, 2017, 03:14:35 PM
:p
May 30, 2017, 10:14:48 PM
Hmph. Spammers!
April 19, 2017, 08:20:44 PM
Also - hai!
April 19, 2017, 08:20:38 PM
Just in case no-one saw it - I posted about i61 over on the wdg-reddit!
April 17, 2017, 02:18:03 PM
April 16, 2017, 12:28:45 PM
Don't mind me, just helping Berath clean up the dust
April 04, 2017, 09:46:13 PM
Mumble server down: I've submitted a ticket
March 13, 2017, 01:20:32 AM
It is. Sleeping
March 11, 2017, 06:24:54 PM
so quiet
December 06, 2016, 03:10:39 PM
Every day or so I drop by to empty out the logs, dust down the furniture and shake out the curtains
November 04, 2016, 05:15:57 PM
How's tricks WDG?
November 02, 2016, 10:36:32 PM
Yay CruelCow!!
November 01, 2016, 08:17:40 PM
Yeah, I still check here regularly
November 01, 2016, 06:16:46 PM
Forum is back up after I did some tinkering. Did anyone notice it was down?!?
September 03, 2016, 05:48:48 PM
Thanks for offering but platformers = frustration for me. All that jumping about and getting impaled
September 03, 2016, 10:54:37 AM
Does anyone want a 75%off coupon for Feist?
July 09, 2016, 02:56:39 PM
I knew you were behind them!
July 08, 2016, 11:40:05 AM
What the fucking hell is all this shit?

You'll be blaming me for shit Tf2 updates next!
July 06, 2016, 11:35:09 PM
Therefore, Lefty is indeed responsible
July 06, 2016, 10:56:20 PM
Wales voted Leave
June 25, 2016, 05:30:56 PM
Well he *is* called Leftism
June 24, 2016, 07:36:47 PM
I'm going to completely unjustifiably hold Lefty to blame for the Brexit.
That is all.
June 05, 2016, 01:56:52 PM
Woop woop i58 ticket bought!
May 13, 2016, 06:08:28 PM
I want that game
May 07, 2016, 10:20:36 PM
its not optimized well just like the ps4 version
May 07, 2016, 09:01:50 PM
why does everyone's gone rapture run like doggegg on my pc
April 13, 2016, 05:18:58 PM
Just to really bang it home. WDG sub-reddit here: https://www.reddit.com/r/WDG/
April 06, 2016, 10:06:39 AM
Thank you Smiley
April 04, 2016, 04:24:56 PM
Just send you one.
April 04, 2016, 10:48:17 AM
If there are any still going, I'll have one
April 02, 2016, 11:47:32 AM
i have beta passes if anyone wants them as well
March 23, 2016, 12:18:40 PM
If anybody wants a tf2 competetive beta pass, i have a spare.
March 18, 2016, 12:18:46 PM
It's too expensive Sad
March 15, 2016, 03:24:04 PM
Will you all go buy The Division now so I have someone to play with? Smiley
March 11, 2016, 08:32:56 PM
FIREWATCH
March 11, 2016, 07:56:09 PM
March 11, 2016, 07:56:08 PM
March 02, 2016, 06:02:38 PM
some of the stealth sections are a bit of a drag, but they're not as bad as the VIP escort missions in THE VITNESS
March 02, 2016, 12:06:23 PM
Easy with the spoilers, guys! I'm still  on the blunderbuss part.
March 01, 2016, 09:17:32 PM
Can't believe Henry managed to use his NAVY Seal experience to defuse the bomb that was strapped to the bear in the end
March 01, 2016, 03:38:29 PM
I just unlocked the rifle scope in firewatch, makes it much easier to pick off bears before they get into melee range
March 01, 2016, 12:34:14 PM
FIREWATCH
March 01, 2016, 12:13:37 PM
I can't believe GAMERS don't like the witness. It's the MOST GAMER game EVER.
February 29, 2016, 12:08:32 PM
Its overrated. Now FIREWATCH on the other side...
February 29, 2016, 11:21:43 AM
I got the basic ending in the witness and it was B A D
February 22, 2016, 10:58:37 AM
I have no understanding of the environmental puzzles
February 22, 2016, 10:58:25 AM
Every so often someone says something about "environmental puzzles" in the witness and I skip it because of spoilers
February 15, 2016, 01:02:48 AM
press x to exercise 5th freedom
February 14, 2016, 11:53:36 AM
My game came with an EXCLUSIVE PREORDER CODE for the Chaos Theory suit, shoulda preordered DUH
February 14, 2016, 02:02:52 AM
i want the super stealth suit.

I go lethal on grim missions
Calendar
October 2025
MoTuWeThFrSaSu
12345
6789101112
13141516171819
20212223242526
2728293031

Birthdays
Chaos (40)

Upcoming Events
Upcoming Birthdays: Chaos (40)
Members
Total Members: 311
Latest: BuildersIslington
Stats
Total Posts: 129727
Total Topics: 3983
Online Today: 376
Online Ever: 555
(October 08, 2025, 07:43:27 PM)
Users Online
Users: 0
Guests: 13
Total: 13
My CommunityForumPublicTechnicalTopic: Database Design (longish, theoretical)
Pages: [1] 2 3
Print
Author Topic: Database Design (longish, theoretical)  (Read 16285 times)
0 Members and 1 Guest are viewing this topic.
Teatime


Karma: 653
Offline Offline

Posts: 1896


Still rubbish after all these years


WWW
« on: September 04, 2010, 03:05:53 PM »

Disclaimer: The following is technically not "technical" Wink, actually not even "applicational", since this concerns the pre-technical phase of db-design, namely to project reality to the structures offered by a relational database. But I guess this is close enough.

Okay, one of my hobbies is creating databases for my various fields of interests (yeah, nerdish).
Currently I'm quite dissatisfied with the way I've designed the db which manages my movie collection, and I'm struggling to find a useful approach to solve the problem. So I thought I might spell my problem out here, mostly to simply "say" it out loud, but also on the off-chance that somebody might have some useful ideas.

My Movie DB collects all movies (Features, Series, Documentaries, etc) I have in any kind of physical form, be it bought media or content recorded and stored on tape or DVD-R. So some bulk of the DB consists of the movies and all the related data (cast/crew, technical data, etc). That part could probably need some revising either, but for the time being it works alright. The part I'm struggling with is the other huge bulk which represents the media management.

Here I'm trying to store each piece of media which holds a movie, series, documentary, etc. And sadly this is quite a complex matter. Commercial applications evade the inherent problems since they a) simplify and b) only deal with the media side.

So, what exactly are the problems?
A specific piece of media might come in many different kinds, challenging a projection to db-structures.
There is your standard DVD holding one movie (ignoring special features at this point). But I also have DVDs with two versions of the same movie. I have DVDs with two different movies. I have DVD-Boxes with a number of different movies. I might have a single episode of a series, or a box with a whole season, or a box holding several seasons of a series. Right now I have a box of "Battlestar Galactica" sitting on my shelf which contains the mini-series, all 4 seasons of the series and a TV movie. I have recordings where I might have episodes of different series on the same medium.

In the current version of my Movie DB I've tried to accomplish that with two tables, one representing the "outer" media (the DVD or Box), the other representing the inner segments (e.g. the episodes on a box of a series, or one movie in a DVD featuring two movies). There was some minor cheating involved to make this work.
But I'm increasingly dissatisfied with that approach, for one because I feel it's a sound and proper design (which bugs the perfectionist in me), but also because I continue to stumble into examples this design can not properly reproduce (like aforementioned "Galactica"-Box).

And all this with keeping track of technical data for the different media, like Codec, Format, Audio, Resolution etc ...

(Now here comes the point where it gets really nerdish Cheesy)

Right now I feel the proper approach to break the two tables and distribute the data further.

One way to deal with the complex structure of media would be to insert an additional layer. Bottom level would be the part of a medium representing a movie or episode. Middle level would combine several bottom level elements (1:n) (like all episodes of one season) and the top level would (potentially) combine several middle level elements (1:n, thought mostly 1:1) (like a box set with several seasons of a series).

The problem with that is that this does not solve the problem, it simply adds a layer which evades the problem for the time being. This structure is just as inflexible as the current one. One day in the future I might encounter some kind of boxset which might no longer be covered by this structure (right of the top of my head: If FOX would offer a box containing all seasons of Buffy and Angel would already break this design).

On top of that I considering to pull out the technical details from these tables and store them in a different place (since some of it is repetitive), connecting those to the respective medium. That again would be something which would require some awkward design.

So here I'm wondering if this might be something which simply can't be projected satisfyingly onto a database or if there might be a completely different approach I just haven't thought of yet.

I know that this is quite specific in the required mindset needed to approach such a problem, and I have no idea if anybody here is working (or has worked) with relational databases and their development. Of course I will welcome any kind of input/suggestion/clarifying question. Just one note for those with experience in Excel (and the like): Don't draw from these experiences. A datasheet and a db-table are very different beasts and a database follows very different rules in structural design.
Logged

Teatime has left the Building ...
Lister
Clan member
***

Karma: 252
Offline Offline

Gender: Male
Posts: 946


Calm down baby, have a piece of cheese.


« Reply #1 on: September 04, 2010, 03:15:38 PM »

What is this, I don't even...

Hmm I'm not the right person to ask but good luck none-the-less!

My dad happens to be a database wizard so if I feel the need to introduce him to my "WDG side" I'll point him to this thread ^^
Logged
Nineblade
Official WDG Tattooed Person


Karma: 1220
Offline Offline

Gender: Male
Posts: 2503


Get witch or die trying


« Reply #2 on: September 04, 2010, 03:28:16 PM »

You nearly had me there T....I almost switched to database design mode then thought fuck it and went back to mixing concrete for my fence posts  Smiley
Logged
Junta
Guest
« Reply #3 on: September 04, 2010, 03:28:28 PM »

You need to give an indication of your existing tables, columns and relations.

If your db doesn't support the data then a new structure is needed. Avoid the desire to model every relationship in a separate table. If titles are linked, you have the possibility of storing them in the same table and linking back to another record in the same table (presumes a decent primary key). This can make querying a pain though, but does support relationships for records of the same type (i.e. films).

Stick to the rules of normalisation but don't be a slave to 3rd normal form.

If in doubt, use an "entity relationship" approach, where you document how things link together BEFORE creating database tables.

For example,

A publisher has one or more authors,
An author has one or more books
A book can have one or more edition
A book has one or more chapters

Where you have a "many to many" relation ship, you need an intermediate entity between the two. For example,
An albumn can have many tracks and a track can be on many albumns - you'd need an intermediate entity of "album track" that documents the relationship between albumns and tracks (assuming a multiplicity of tracks and albumns).
« Last Edit: September 04, 2010, 03:37:29 PM by Junta » Logged
scroggage
Guest
« Reply #4 on: September 04, 2010, 03:32:06 PM »

Stick to the rules of normalisation but don't be a slave to 3rd normal form.
Second normal form FTW.

I vaguely remember learning about de-normalising a couple of years back, now I have it all to learn again this year Sad
Logged
Junta
Guest
« Reply #5 on: September 04, 2010, 03:36:34 PM »

You tend to de-normalise for performance. Some of the databases I work on have over 11 million rows Wink
Logged
Teatime


Karma: 653
Offline Offline

Posts: 1896


Still rubbish after all these years


WWW
« Reply #6 on: September 04, 2010, 04:07:23 PM »

You need to give an indication of your existing tables, columns and relations.



What was the resize-command again?

The tables in question are tblMedia and tblMedium.
The section covering the actual movies will probably need an overhaul as well, but that's more a tweaking than a redesign.

If your db doesn't support the data then a new structure is needed. Avoid the desire to model every relationship in a separate table. If titles are linked, you have the possibility of storing them in the same table and linking back to another record in the same table (presumes a decent primary key). This can make querying a pain though, but does support relationships for records of the same type (i.e. films).

Yes, I am toying with such an idea (actually to some degree that is what I am doing so far). But this would require thorough examination to see what implications it might have on further analytical stages. (Yes, queries would quickly turn into a pain-in-the-ass since basically all details would be derived from queries-within-queries)

But it's nice to see I have an expert here Wink
« Last Edit: September 04, 2010, 04:23:57 PM by Teatime » Logged

Teatime has left the Building ...
DeadlyAvenger
Ex-Leader
Donator
*

Karma: 1265
Offline Offline

Gender: Male
Posts: 5291


Spam, Egg, Sausage, Chips and Spam


WWW
« Reply #7 on: September 04, 2010, 04:33:15 PM »

Yeah - John is the best person that I can think of to ask about this sort of stuff.

I only read through it briefly - but can you not have some kind of parent/child set-up going with a database table referencing itself?

I'm not quite sure the best way to explain it - but have it so that you have a tree of data items that have sub-items stored in the same table. The only example (and unrelated at that) that I can think of is how you might have an online shop with categories of different types of products. You would have a categories table in the database detailing all of the categories with 2 fields that have a 'parent of' and 'child of'.

So let's say your top categories were 'Music', 'Video', 'Games' - each of those would have a row in the categories table. Let's then say you had 'Action Games' which would have a parent id of the games row.

You would then use some kind of (recursive) algorithm that would read through all of the categories using the child / parent fields until it reached the bottom of the tree.

I'm not sure if that makes sense, or even if it could be applied to your situation - but it's fairly flexible.
Logged

Zarf
Clan member
***

Karma: 710
Offline Offline

Gender: Male
Posts: 2161


The Paragon of Animals


WWW
« Reply #8 on: September 04, 2010, 05:02:31 PM »

rusty on database design and probably missing something but doesn't look too difficult.

I'm not using your entity names here, just working from a clean perspective.




Personally, downloading all my stuff has worked wonders here, XBMC (xbox media center) has scraped all thousand or so of my movies on my NAS with their IMDB info and poster artwork, and I use a nice program called "TV Rename" to keep all my TV episodes organised, all I need to do is to scan my download folder every so often, it pattern matches the names and episode numbers and renames/moves the file into the correct folder along with cleaning up the file name and adding the episode title. It also downloads fanart and updates an xml file in the season folder that my XBMC reads containing all the info pulled down from theTVDB.org.
« Last Edit: September 04, 2010, 05:16:06 PM by Zarf » Logged

Nineblade
Official WDG Tattooed Person


Karma: 1220
Offline Offline

Gender: Male
Posts: 2503


Get witch or die trying


« Reply #9 on: September 04, 2010, 05:05:54 PM »

You tend to de-normalise for performance. Some of the databases I work on have over 11 million rows Wink

LOL I always thought normalisation was for exams only and could be forgotten about once said exam had been passed.  Wink
Logged
Teatime


Karma: 653
Offline Offline

Posts: 1896


Still rubbish after all these years


WWW
« Reply #10 on: September 04, 2010, 06:15:03 PM »

@Deadly
Yes, you can do that. That's pretty much was John mentioned as possible approach.
Problem is that for queries (filtering data by criteria) you have to connect two queries (one to select the parents and then - based on that - the children) which is possible, but probably not too good for performance (but tbh I haven't worked much which such nested queries before, so I might be wrong).

@Zarf
Nah, this is just a more elaborate version of what I have discussed initially, and the "n:m" relationship doesn't really apply to my structure.
It's far too rare to have the exact same media or content as part of different containers (e.g exactly the same DVD as part of two box-sets) to justify the additional linking tables.
« Last Edit: September 04, 2010, 06:18:56 PM by Teatime » Logged

Teatime has left the Building ...
DeadlyAvenger
Ex-Leader
Donator
*

Karma: 1265
Offline Offline

Gender: Male
Posts: 5291


Spam, Egg, Sausage, Chips and Spam


WWW
« Reply #11 on: September 04, 2010, 07:37:20 PM »

@Deadly
Yes, you can do that. That's pretty much was John mentioned as possible approach.
Problem is that for queries (filtering data by criteria) you have to connect two queries (one to select the parents and then - based on that - the children) which is possible, but probably not too good for performance (but tbh I haven't worked much which such nested queries before, so I might be wrong).

@Zarf
Nah, this is just a more elaborate version of what I have discussed initially, and the "n:m" relationship doesn't really apply to my structure.
It's far too rare to have the exact same media or content as part of different containers (e.g exactly the same DVD as part of two box-sets) to justify the additional linking tables.

Is performance a big issue? Surely a 1 user database, with fairly limited numbers of records performance isn't a big issue.

Also...sometimes it can be easier and better performance to do less in queries and more programmatically (in whatever programming language you're doing this in).
Logged

Teatime


Karma: 653
Offline Offline

Posts: 1896


Still rubbish after all these years


WWW
« Reply #12 on: September 04, 2010, 09:00:19 PM »

Is performance a big issue? Surely a 1 user database, with fairly limited numbers of records performance isn't a big issue.

No, it is not.
But before I resort to some half-arsed compromise I'm trying to see if there's a more structural sound way to do it.

I'm brooding about something like that not only to make things work, but also to learn more about the technique and elements behind it, and taking the easy way out is really just a last resort.
Logged

Teatime has left the Building ...
CruelCow
Unofficial Official Non-WDG WDG member


Karma: 1665
Offline Offline

Gender: Male
Posts: 5922


Move along. Nobody suspicious is here.


« Reply #13 on: September 04, 2010, 09:37:08 PM »

IMHO you're approaching this from the wrong side. Don't try to save every single possible information (are you saving which actor appears in which episode scene?), ask yourself what you want to query for. Do you really query for all boxes that contain movies and seasons? Or do you rather query for all-galactica-stuff-I-have?
Logged
claws
Guest
« Reply #14 on: September 04, 2010, 09:44:37 PM »

It's a good question, because you can very easily go into relational table hell here. /personally/ I wouldn't overdesign it and leave yourself a lot of flexibility in having a (say) 'features' table with all the actual playing thing info, and then tag that in one or two more tables. So one dvd with two movies on (reg and directors cut), i'd have a table with metainformation and tie that feature with 'directors cut'. The virtue of this kind of thing is that it makes your hypothetical boxset quite easy: you have a bunch of features on several dvds, and those dvds are tied together with 'boxset' info.

(Sorry, this post a bit rambly, I made a better one and my browser crashed) Smiley
Logged
Pages: [1] 2 3
Print
My CommunityForumPublicTechnicalTopic: Database Design (longish, theoretical)
Jump to:  


Who Dares... Grins UK TF2 Clan