Click here to Skip to main content
15,881,173 members
Home / Discussions / Database
   

Database

 
GeneralRe: Want to avoid Dynamic Sql even if the Table name is random Pin
indian14317-Apr-17 10:04
indian14317-Apr-17 10:04 
QuestionRe: Want to avoid Dynamic Sql even if the Table name is random Pin
CHill6018-Apr-17 4:19
mveCHill6018-Apr-17 4:19 
GeneralRe: Want to avoid Dynamic Sql even if the Table name is random Pin
Mycroft Holmes18-Apr-17 14:33
professionalMycroft Holmes18-Apr-17 14:33 
GeneralRe: Want to avoid Dynamic Sql even if the Table name is random Pin
indian14320-Apr-17 12:58
indian14320-Apr-17 12:58 
GeneralRe: Want to avoid Dynamic Sql even if the Table name is random Pin
Mycroft Holmes20-Apr-17 14:10
professionalMycroft Holmes20-Apr-17 14:10 
GeneralRe: Want to avoid Dynamic Sql even if the Table name is random Pin
CHill6023-Apr-17 22:26
mveCHill6023-Apr-17 22:26 
Questioncontext::Context(void) - cs_ctx_alloc() failed Pin
papi2414-Apr-17 1:29
papi2414-Apr-17 1:29 
QuestionRelational Database Design for N dimensional function, I have some problems Pin
User 110609796-Apr-17 3:26
User 110609796-Apr-17 3:26 
My task is: Our users get from their chemical suppliers some tables do determine the required quantity for chemical Y based on the given quantity of chemical X.
BTW: The task is_not_ to find a linear regression formula.
Easy example- 2 Dim: Depending on X the component Y has to be used with different quantities:
X  	 Y= f(X)
1	0.1
2	0.2
3	0.5

In Praxis this will be not only y= f(x) it is more r=f(x,y,z, ...) and much more it is (r, s, t, ...)= f(x, y, z, ....) but the later is not the discussion here.
Now I'm asking me how one can design a General database layout with a constant number of tables/fields to save an N dimensional function.
With constant number of tables/fields I mean I don't like to solve this task by creating "dynamicly" columns according to the bigest dimension in use... or so Wink | ;)

Note: I have also to say most probably I’m not going to save this kind of data in a set of related tables, but anywhere I’m interesting how one would do it theoretically, maybe this gives me some more ideas and last but not least to learn.

The dimensions are usually around 3 to 5, but I like to solve: How can one design a General Database Table Layout -for N dimensions - for this task?

Is started like this
// TBLS: The Main Table to define a specific N Dimensional User- Function)
TBLS		        
  ID            (P)
  NAME

// TBLS_BASES: In this table the bases of the User Function will be defined
TBLS_BASES	       
  ID            
  TBLS_ID       (P)   FK: TBLS.ID
  BASE_ID       (P)
  BASE_NAME

// TBLS_BASES_VALUES: In this table the bases values will be defined
TBLS_BASES_VALUES
  ID
  TBLS_ID       (P)   FK: TBLS_BASES.TBLS_ID 
  TBLS_BASES_ID (P)   FK: TBLS_BASES.BASE_ID
  POS           (P)
  VALUE               // The base value, basically the candidate for PrimKeySeg, but 
                      // replaced by POS for the sake of simplifying

// TBL_VALUES: The table to finally save the function values. Here I have my big problem
TBL_VALUES  
  TBLS_ID             FK: TBLS_BASES_VALUES.TBLS_ID 
  TBLS_BASES_ID       FK: TBLS_BASES_VALUES.TBLS_BASES_ID
  POS                 FK: TBLS_BASES_VALUES.POS
  VALUE               // Finally the function value

Now an example for three dimension z= f(x, y)
First the three "base" tables for the function
TBLS        TBLS_BASES                       TBLS_BASES_VALUES
======      ==========================       ==========================================
  ID          BASE_ID TBLS_ID  BASE_NAME	TBLS_ID    TBLS_BASES_ID    POS    VALUE
  (P)         (P)     (P)                         (P)        (P)              (P)
  ----        ----    -------  ---------          -------    -------------    ---    -----
  T1          T1B1    T1       e1                 T1         T1B1             1      0.1
                                                  T1         T1B1             2      0.2
                                                  T1         T1B1             3      0.3

  T1          T1B2    T1       e2                 T1         T1B2             1      0.7
                                                  T1         T1B2             2      1.2
                                                  T1         T1B2             3      3.4

And here my Problem comes
In case of 3Dim always for 2 bases are needed to save one function value, in case if 4Dim it Needs a Group of 3 bases to save a function value, and so on...

Does any body has a sugestion for a better layout? At the moment I'm blocked and don't see a way how I can link a "Group" of items to one specific "Point".

TBL_VALUES
==========================================
  TBLS_ID    TBLS_BASES_ID    POS    VALUE
  -------    -------------    ---    -----
  T1         T1B1             1      1
  T1         T1B2             1      1

  T1         T1B1             1      2
  T1         T1B2             2      2

  T1         T1B1             1      3
  T1         T1B2             3      3

  T1         T1B1             2      4
  T1         T1B2             1      4

  T1         T1B1             2      5
  T1         T1B2             2      5

  T1         T1B1             2      6
  T1         T1B2             3      6

  T1         T1B1             3      7
  T1         T1B2             1      7

  T1         T1B1             3      8
  T1         T1B2             2      8

  T1         T1B1             3      9
  T1         T1B2             3      9

Sorry for my english and thank you in advance for some tips.
Bruno

[Edit]
Sorry for that, after about 2h edit I hope it is finally done, but preview does not really works nice Smile | :)
Ok, it was not only preview Smile | :)

modified 19-Jan-21 21:04pm.

AnswerRe: Relational Database Design for N dimensional function, I have some problems Pin
Mycroft Holmes6-Apr-17 11:40
professionalMycroft Holmes6-Apr-17 11:40 
GeneralRe: Relational Database Design for N dimensional function, I have some problems Pin
User 110609796-Apr-17 19:18
User 110609796-Apr-17 19:18 
QuestionCannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" Pin
indian1435-Apr-17 9:53
indian1435-Apr-17 9:53 
AnswerRe: Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" Pin
Mycroft Holmes5-Apr-17 12:46
professionalMycroft Holmes5-Apr-17 12:46 
QuestionWhat is merge join in sql server Pin
Tridip Bhattacharjee23-Mar-17 22:56
professionalTridip Bhattacharjee23-Mar-17 22:56 
AnswerRe: What is merge join in sql server Pin
CHill6023-Mar-17 23:36
mveCHill6023-Mar-17 23:36 
GeneralRe: What is merge join in sql server Pin
Richard MacCutchan24-Mar-17 1:40
mveRichard MacCutchan24-Mar-17 1:40 
GeneralRe: What is merge join in sql server Pin
CHill6028-Mar-17 1:31
mveCHill6028-Mar-17 1:31 
GeneralRe: What is merge join in sql server Pin
Tridip Bhattacharjee27-Mar-17 22:33
professionalTridip Bhattacharjee27-Mar-17 22:33 
GeneralRe: What is merge join in sql server Pin
CHill6028-Mar-17 0:42
mveCHill6028-Mar-17 0:42 
GeneralRe: What is merge join in sql server Pin
Eddy Vluggen28-Mar-17 1:35
professionalEddy Vluggen28-Mar-17 1:35 
QuestionGet all Packages that are failed to execute Pin
indian14321-Mar-17 14:15
indian14321-Mar-17 14:15 
QuestionGETTING EXCEPTION ON JDBC TRANSACTION MGMT --->java.sql.SQLException: Invalid column index:at LINE 8 & 12 Pin
LOKENDRA YADAV10-Mar-17 21:13
LOKENDRA YADAV10-Mar-17 21:13 
QuestionRe: GETTING EXCEPTION ON JDBC TRANSACTION MGMT --->java.sql.SQLException: Invalid column index:at LINE 8 & 12 Pin
Richard MacCutchan10-Mar-17 21:55
mveRichard MacCutchan10-Mar-17 21:55 
AnswerRe: GETTING EXCEPTION ON JDBC TRANSACTION MGMT --->java.sql.SQLException: Invalid column index:at LINE 8 & 12 Pin
LOKENDRA YADAV10-Mar-17 21:58
LOKENDRA YADAV10-Mar-17 21:58 
AnswerRe: GETTING EXCEPTION ON JDBC TRANSACTION MGMT --->java.sql.SQLException: Invalid column index:at LINE 8 & 12 Pin
LOKENDRA YADAV10-Mar-17 22:05
LOKENDRA YADAV10-Mar-17 22:05 
GeneralRe: GETTING EXCEPTION ON JDBC TRANSACTION MGMT --->java.sql.SQLException: Invalid column index:at LINE 8 & 12 Pin
Richard MacCutchan10-Mar-17 22:27
mveRichard MacCutchan10-Mar-17 22:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.