![]() | |
#11
| |||
| |||
|
|
* * *A difference in column names does not change whether the table design is denormalised. |
|
I don't want to discuss design of this table. This is table which is existing and I can't change it. * * *Then why are you asking about table design if there is nothing that can be done? |
#12
| |||
| |||
|
|
In general, a "smart way to store this data in the DB" implies some kind of new table design. *In another response, you indicate that you're stuck with the existing table design. Which is it? |
)
#13
| |||
| |||
|
|
Hi, I have to make custom reports solution in PHP + MySQL and I'm looking for the best way to design part of my database. I will appreciate any help. I have to store option to display custom reports on selected table. There has to be an option to easily modify report criteria at any time. For example let's say I have table called 'ExampleTable' in DB which has 20 different columns. Just few column names for example 'ID', 'Name' , 'Desc', 'Date' , 'ValueA', 'ValueB'. User on PHP site can choose that he wants to have report for 'ExampleTable' with selected columns: 'Name', 'Date' and 'ValueB' sorted by ID asc and he wants only rows where 'ValueB'= 4 and Date '29/07/2008'. Basically *almost any kind of criteria. *Could be also something like : ('ValueB'=4 OR ValueB' = 6 OR 'ValueB'>30) AND ('Date' = > '29/07/2008' OR Name = 'special' ). Let's say everything which has form 'something AND/OR something' plus possible parenthesis but to make it simpler only one level of parenthesis ( not something like (A OR *(B AND C) OR D) *OR E ). Has anyone good idea how to store it in database for easy editing later on? I can store whole WHERE clause *as text but then I have to parse everything in PHP to let user modify it :/ For sure I can store conditions as 'Name' = 'special' in separate table (probably as 3 separate fields - column/condition/value ) and then just store condition in form '(1 OR 2) AND (3 OR 4) ' *with numbers of entries instead of basic conditions *but I have no better idea how to divide the whole query to store it more easily :/ Any suggestions? All ideas appreciated ![]() Quleczka |
#14
| |||
| |||
|
|
What I I want to design is smart way is a new table (or few tables) to store custom report criteria in it. |
#15
| |||
| |||
|
|
* * *A difference in column names does not change whether the table design is denormalised. How you can tell if table is denormalised or not if only info you have about it is that it does contain some columns? |
|
I don't want to discuss design of this table. This is table which is existing and I can't change it. * * *Then why are you asking about table design if there is nothing that can be done? I don't want to discuss design of existing table which report is based on. Basically this can be any table. Just some random table with some columns. Also column names are not important or the fact if existing table is denormalised or not. I can't change this existing data structure. I was asking about advice how to create new tables (or tables) to store the report criteria in easy to access way. |
![]() |
| Thread Tools | |
| Display Modes | |
| |