473,387 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Looking for "best practices" type suggestion.

Haitashi
I have a database that currently contains different albums. The way I had the database was that there is a "description" field in which I placed all the songs. When I access my site I see in information of a CD and a paragraph that contains all the data I put in the "description" field. I am thinking of adding an "advanced search" feature to the site where the user can select Artist or Song Title. However, how can I ensure that it looks into each song individually?

My first instinct was to have each song be a record in the database that is tied to an album (maybe by that album's ID) I have about 5k albums in my database so I have my work cut our for me if I do that.

Any ideas/suggestions so that the user may search for songs?

Here's an example of an insert statement with data of a particular album that is currently in my database so you can get an idea of what I currently have:

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO `products_description` (`products_id`, `language_id`, `products_name`, `products_description`, `products_url`, `products_viewed`) VALUES
  2. (1, 1, 'BOBBY VALENTIN - THE BEST - CD', '1- HURACAN  \r\n2- VETE PA LLA  \r\n3- PIRATA DE LA MAR  \r\n4- BESO BORRACHO  \r\n5- GUARAMBEMBERE  \r\n6- POBRE SOY  \r\n7-SOY BORICUA  \r\n8- SON SON CHARARI  \r\n9- PIENSALO BIEN  \r\n10- PAPEL DE PAYASO  \r\n11- TOTAL PARA NADA', '', 21);
Aug 26 '08 #1
2 1427
coolsti
310 100+
Your current design does not make use of the powers of a relational database, so yes, you should definitely change the structure of your tables. You make another table that contains a row for each song title, and you make columns in that table that contain the attributes of the song titles that are specific to the song titles (and not general for the entire CD). You also have a foreign key in that table which at best will be an integral primary key of the main table containing your CD information.

Then in order to select all the information for a CD including all titles, you use a table join. And by using appropriate WHERE clauses, you also now have the ability to search for titles and also to order the results by title alphabetically.

As for the conversion of the database from one form to another, you can probably do this with some queries, for example while accessing your database via a mysql console window. But since it involves multiple inserts into the new sub table, I would do this by making a script for example in PHP that reads all the information from your current table and then in a loop inserts the appropriate data into the new table for the song titles. Then I would go into a mysql console window and drop the no longer needed song title column from the original table.
Aug 27 '08 #2
Gotcha. I definitely have some work ahead of me but what you said makes perfect sense. Thanks!
Aug 28 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Wm | last post by:
As an amateur wannabe-pro programmer, I am trying to learn not only how to use PHP but how to do it *efficiently*. (Trust me, you don't wanna see some of my stuff!!!) I'm noticing a number of my...
1
by: Aaron Davies | last post by:
I'm developing a collaborative whiteboard, in which all objects (shapes, clip art icons, etc.) are synchronized between all participants in a session. It's working well, but I'm running into a...
5
by: Andrew S. Giles | last post by:
I thought I would post here, as I am sure someone, somewhere has run into this problem, and might have a good solution for me. I am writing an applicaiton in C# that will accept data and then put...
1
by: Anders K. Jacobsen [DK] | last post by:
Hi Im developing an ASP.NET CRUD application where i need to do some authorization checks on surden actions. Eg. some account have access to delete in a sudden datagrid and some have not. So I...
5
by: Achim Domma | last post by:
Hi, I have to convert a string to its "best possible" ascii representation. It's clear to me that this is not possible or sense full for all unicode characters. But for most European characters...
1
by: Pythor | last post by:
OK I'm trying to create a sql query on our as400. I have a main table like this: acct prf acct no. sku AAA 123 ABCD AAA 123 XYZ I have...
9
by: =?Utf-8?B?QW1tZXI=?= | last post by:
I've read many incomplete opinions about the "Best Practice" for securely accessing SQL but what I really need to find the "Best Practice" that fits my applications needs. Currently (alpha...
2
by: hotflash | last post by:
Hi All, I found the best pure ASP code to upload a file to either server and/or MS Access Database. It works fine for me however, there is one thing that I don't like and have tried to fix but...
1
by: =?ISO-8859-1?Q?Andr=E9?= | last post by:
Hi everyone, I'd be interested in hearing suggestions as to the "best" way to drive a Python program step by step from another application. Details: --------- I have implemented a "Robot"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.