Any database gurus out there?

with industry Pro, Nick Batzdorf

Moderators: mdc, admin, TAXIstaff

teleblaster
Serious Musician
Serious Musician
Posts: 1236
Joined: Sun Jan 06, 2008 3:07 pm
Gender: Male

Any database gurus out there?

Post by teleblaster »

I'm building a db to store interesting data about my compositions. I have one main table called 'song' that has the typical fields: tempo, key, title, feel*, style*, etc. The goal is to be able to build select queries that return interesting record sets like: list all country songs with tempos greater than 120; list all songs published by Acme publishing; etc.

I want to add a field for writers to represent all the writers of any one compositionand am having some trouble designing it. The writer field needs to have 1-n contacts** that each have a percentage associated with them to support real world scenarios (3 writers all with 33.3%, etc.) Anyone have a suggestion for designing this field. The important aspects of this would be to enable select queries to find all songs that writer 'john smith' worked on whether s/he owned 100% of the writer shares or a lower percentage.

I'm a programmer, but I don't have much db experience. Apologies if the above description is poor db parlance

Thanks
Erich



* these are stored as integers/foreign keys that map out to indexes in seperate tables. Those tables hold the actual values: jazz, rock ; or aggresive, happy etc
** These will be like above, foreign keys to a contacts table
User avatar
Casey H
King of the World
King of the World
Posts: 15041
Joined: Tue Jan 27, 2004 10:22 pm
Location: Philadelphia, PA

Re: Any database gurus out there?

Post by Casey H »

What database program are you using? Access?

I'm a programmer (software engineer) but not very db-literate... just dabbled a bit years ago. The problem you are asking about sounds pretty basic. If you are using Access (or any program probably) there are losts of entry level self-tutorial books out there. You might want to go to a book store like Barnes and Noble and browse.

A book I remember from years ago that was very good was:
http://www.amazon.com/Database-Design-M ... 0201694719
This is generic about database tables, keys, relationships (one-to-one, one-to-many, many-to-many, etc)...

Sorry I can't offer more specific advice.

Best
:) Casey
fusilierb
Serious Musician
Serious Musician
Posts: 3009
Joined: Sun Sep 21, 2008 3:38 am
Gender: Male
Location: New Orleans, LA

Re: Any database gurus out there?

Post by fusilierb »

teleblaster wrote:I'm building a db to store interesting data about my compositions. I have one main table called 'song' that has the typical fields: tempo, key, title, feel*, style*, etc. The goal is to be able to build select queries that return interesting record sets like: list all country songs with tempos greater than 120; list all songs published by Acme publishing; etc.

I want to add a field for writers to represent all the writers of any one compositionand am having some trouble designing it. The writer field needs to have 1-n contacts** that each have a percentage associated with them to support real world scenarios (3 writers all with 33.3%, etc.) Anyone have a suggestion for designing this field. The important aspects of this would be to enable select queries to find all songs that writer 'john smith' worked on whether s/he owned 100% of the writer shares or a lower percentage.

I'm a programmer, but I don't have much db experience. Apologies if the above description is poor db parlance

Thanks
Erich



* these are stored as integers/foreign keys that map out to indexes in seperate tables. Those tables hold the actual values: jazz, rock ; or aggresive, happy etc
** These will be like above, foreign keys to a contacts table
Just kind of quickly reading through it, it seems like you want another table to store writer names in that you can pull into the main table from (oh wait, you already said your doing that from the contact table, nevermind). Then add a couple of more fields to your main table where you can store up to X number of writers and add fields for percentages each owns, (writer 1 percentage, writer 2 percentage, etc.) You should be able to get all of that with the select query by some sort of query of the writer and a <100% formula to evaluate which writers to pull based off the value in the percentage fields you add.

Does that make any sense?? I'm not sure if it does to me.
B
User avatar
bigbluebarry
Serious Musician
Serious Musician
Posts: 1715
Joined: Wed Jan 02, 2008 4:42 pm
Gender: Male
Location: Nashville, TN

Re: Any database gurus out there?

Post by bigbluebarry »

Hey Erich,

I would create a couple of related tables. You'll need one to contain your writer information and another one to contain the writer's share on a per song basis and then another one to contain the publisher information and one more to contain the publisher's shares. You'll need to set up some foreign key relationships with your 'song' table as well. You can make this as simple or complex as you want. Here's a simple version.

Table Name: Writers
Fields:
WriterId (int) - set this up as identity field (autonumber if you're using Access) and as the Primary Key
WriterName (varchar) - this will store the writer name (ex: John Smith)
PRO (varchar)

Table Name: WriterShares
Fields:
WriterShareId (int) - set this up as identify field
WriterId (int) - this will store the "Key" value that is associated with the WriterId field from the Writers table
SongId (int) - this will store the "Key" value that is associated with the SongId from the 'songs' table
Percentage (decimal) - this will store the percentage value of that writer's share for the song

Table Name: Publishers
Fields:
PublisherId (int) - set this up as an identify field
PublisherName (varchar) - this will store the publisher name (ex: Teleblaster Publishing)
PRO (varchar)

Table Name: PublisherShares
Fields:
PublisherShareId (int) - set this up as an identify field
PublisherId (int) - this will store the "Key" value that is associated with the PublisherId field from the Publishers table
SongId (int) - this will store the "Key" value that is associated with the SongId from the 'songs' table
Percentage (decimal) - this will store the percentage value of that publisher's share for the song

Then you'll create the following relationships:

Primary Key ==> Foreign Key
Songs.SongId ==> WritersShare.SongId
Songs.SongId ==> PublishersShare.SongId
Writers.WriterId ==> WritersShare.WriterId
Publishers.PublisherId ==> PublishersShare.PublisherId

That should get you started :-)

hth,
- Big Blue
Last edited by bigbluebarry on Wed Mar 03, 2010 4:02 am, edited 1 time in total.
Imagine a steel cage match between Daughtry, Coldplay, Paramore and Demon Hunter with Joe Satriani as the referee...

http://www.taxi.com/bigbluebarry
http://www.bigbluebarry.com
http://www.twitter.com/bigbluebarry
fusilierb
Serious Musician
Serious Musician
Posts: 3009
Joined: Sun Sep 21, 2008 3:38 am
Gender: Male
Location: New Orleans, LA

Re: Any database gurus out there?

Post by fusilierb »

Yeah, what Big Blue said. :?
teleblaster
Serious Musician
Serious Musician
Posts: 1236
Joined: Sun Jan 06, 2008 3:07 pm
Gender: Male

Re: Any database gurus out there?

Post by teleblaster »

Table Name: WriterShares
Fields:
WriterShareId (int) - set this up as identify field
WriterId (int) - this will store the "Key" value that is associated with the WriterId field from the Writers table
SongId (int) - this will store the "Key" value that is associated with the SongId from the 'songs' table
Percentage (decimal) - this will store the percentage value of that writer's share for the song


I wasn't putting a SongId into the writer's share table. But it makes sense. I think I was moving along the same lines by havine a writer's share table with just contgact and percentage, and then expressing the Song relationship by adding a writers share field in the song table that takes one or more record Ids from the writers share table). Enforcing schema that ensures all shares add up to 100% will be interesting...

Thanks all for the input. Once I get this in some usable form you're all welcome to a copy. I'm hashing it out in Access for now, and plan to migrate it to the new MS cloud computing service: Azure.

Erich
orest
Serious Musician
Serious Musician
Posts: 3019
Joined: Thu May 29, 2008 4:55 pm
Gender: Male
Location: Sweden

Re: Any database gurus out there?

Post by orest »

I programmed an access database (guest book) using asp programming and linking it to an excel file.
I had a lot of problems with that guest book so I decided to get a free one instead.

But you should be able to make an excel file and save as a db file? Microsoft use asp and php is a free database language.

So, if you're doing an excel file and connect it with asp coding, you will need to have a server that supports that script. In most cases, php is the script supported.
User avatar
mojobone
King of the World
King of the World
Posts: 11843
Joined: Sat May 17, 2008 11:20 pm
Gender: Male
Location: Up in Indiana, where the tall corn grows

Re: Any database gurus out there?

Post by mojobone »

[sound of Mojo's head exploding]
The Straight Stuff; Roots, Rock & Soul

http://twangfu.wordpress.com
http://twitter.com/mojo_bone
User avatar
t4mh
Serious Musician
Serious Musician
Posts: 1446
Joined: Wed Nov 26, 2008 11:05 pm
Gender: Male
Location: Indiana

Re: Any database gurus out there?

Post by t4mh »

Teleblaster

Been a while since I worked with a database so I'll try to make this as simple as possible. Relational databases are not hard. They just can become quite large! Think of the telephone company!

I think if you open your .dbm file using Excel, the solution how to add fields will become apparent. The columns are your fields. That is of course if you are using Access. Be sure to re-save your file as the .dbm once your done in Excel. This is extremely more complicated if you are using an older database software like dBase.

If you are a really good typist, you can knock out a database pretty quickly just using Notepad. You wont have any fancy formatting like fonts and stuff. An Excel file .xls and an Access .dbm file are really just .csv files ( comma separated value ). So you type:

text, text, text, how ever many fields you need
text, text, text, etc...
text, text, text, you get the picture

Import the csv file into Access and bingo you have a database! Excel can also open the csv. Its the Excel .xls and the Acess .dbm files where you can make it look pretty.

Lastly, if you have the latest MS Office software, then import/export operations are even easier under the [FILE] menu.

HTH
Keith
I hear the voice of God in a bending guitar string!
Life is too important to be taken seriously
No electrons were harmed in the construction of this message.
http://www.t4mh.com
orest
Serious Musician
Serious Musician
Posts: 3019
Joined: Thu May 29, 2008 4:55 pm
Gender: Male
Location: Sweden

Re: Any database gurus out there?

Post by orest »

Yes, I'm with Keith on this one.