Database Design - Multiple Customer Tables

Scenario:
- Let's say there are various customer "types"
- Each one has a set of attributes which is only applicable to that customer type.
- You have a table for orders that is for all customers
- Want to treat it as one customer table for reports, updates, etc...
The solution we've come up with is to basically have a lookup table which allows you to lookup the table the customer record exists in. The order table would have a "customer type" column to key off of. You then use a view to fill in the missing columns from each table for say a global query.
I'm assuming this is a common business problem so thought I would ask the experts if there's a "best practice" for solving this problem.
Thanks

Think vertically ... not horizontally.
An infinite number of attributes can be stored in finite space if you do. For example:
CREATE TABLE horizontal (
customer_id    NUMBER,
attribute_val1 VARCHAR2(20),
attribute_val1 VARCHAR2(20),
attribute_val1 VARCHAR2(20));
CREATE TABLE vertical (
customer_id     NUMBER,
attribute_name VARCHAR2(20),
attribute_value  VARCHAR2(20),The first example requires you to add a column and break everything every time you add a new attribute. The second keeps right on working.

Similar Messages

  • Database adjustment for custom table with 200 entries

    Hi,
    We have a custom table which as 3 fields as composite primary key. we want to drop the last field from composite primiary key. Would it be required to do a manual database adjustment or would it automatically adjust the database if I make this change and trasport it.
    Please advise.
    Regards
    Kasi

    Hi,
        you have to adjust database manually using
        se11-utilities-database utiity-> click on
        activate and adjust database button .
        if you have table mainitainence defined delete
        existing table mainitainence and create a
        new mainitainence and assign this to request.
        so that when request is transported
        correction to databse are made in quality 
        and production as well.
        select standrad recording routine radio in table
        table mainitainence generator to move table
        contents to quality and production by assigning
        to request.    
    Regards
    Amole

  • Database design with some tables with EAV format

    We are designing a database in which most tables follow a straight relational design.  Some tables, however, would benefit from an entity-attribute-value structure.
    Specifically, we want to be able to add new value categories simply by adding a row in a data dictionary table.  At a later point, we want to create cursors where those categories show up as columns.
    Can someone point to tools or generic code that does that job?
    Thank you very much,
    Alex

    You dont need to cursors to show the entities as columns. It can be done using set based code. The concept is called cross tabbing or pivoting
    See this examples
    www.mssqltips.com/sqlservertip/1019/crosstab-queries-using-pivot-in-sql-server/
    https://www.simple-talk.com/sql/t-sql-programming/creating-cross-tab-queries-and-pivot-tables-in-sql/
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Importing data from Microsoft excel file to Oracle Database with Multiple Data Tables. Need expert advice and guidance

    I posted a query on Importing data from Microsoft Excel to Oracle Database (Multiple Data Tables). I got some answer and reference from the forum.
    I presented to my Oracle consultant and representative from Oracle Malaysia. They said impossible. I do not believe what they said. I do believe can be done.
    Can someone help or direct me to an expert that can help me on this

    e90f478a-c529-4c48-b189-51eebeaed477 wrote:
    I posted a query on Importing data from Microsoft Excel to Oracle Database (Multiple Data Tables). I got some answer and reference from the forum.
    I presented to my Oracle consultant and representative from Oracle Malaysia. They said impossible. I do not believe what they said. I do believe can be done.
    Can someone help or direct me to an expert that can help me on this
    We don't know the "query on Importing data from Microsoft Excel to Oracle Database (Multiple Data Tables). "
    We don't know where you posted said query.
    We don't know what "some answer and reference" you received "from the forum."
    We don't know what it was that your "Oracle consultant and representative from Oracle Malaysia" said was "impossible".
    So on what basis are we supposed to "help or direct" to "to an expert that can help "?

  • Database Design - multiple schemas

    Hi!
    We're currently designing a DB for an AUTHENTICATION SYSTEM where several users from different companies (around 40) will have to be authenticated -- connected to ORACLE. Authentication and faster recovery is important.
    Recovery/Backup
    An issue raise where what if the schema encountered a problem then of course you have to backup the entire data. So we are considering to use multiple schemas.
    One Company = One Schema
    So if one schema is down then other schemas will not be affected and faster to recover.
    Actualy, we're quite hesistant to use multiple schemas because of maintainability -- Managing different schemas and too much burder for our developers.
    Will the idea of having multiple schemas be advantageous to what we want to achieve?
    Is this a good design or any other idea to handle this kind of situation?
    Can Partitioning do the same?
    Thanks a lot

    Advantages of multiple schemas:
    - each schema is entirely separate
    - you can maintain at different times/dates for different companies
    - different schemas could be on different databases / servers
    Disadvantages
    - any 'shared' data may have to be duplicated (but you can always use a shared schema for reference data)
    - yes, you have to maintain each schema separately (but that would be by scripts, and at least they'd be well tested!)
    The dictionary (SYS tables) will be somewhat larger (40 copies of table, index, pl/sql definitions)
    - you'll have 40 identical sets of SQL cached; they all look the same, but relate to different schemas. So you need a bigger SGA.
    Can Partitioning do the same?No - partitioning is a solution to a physical problem, not a security problem
    Is this a good design or any other idea to handle this kind of situation?I think either way works - it depends on size, number of users, are you using a third tier, etc.
    Or, with a single schema, you can use VPD - virtual private database (otherwise known as FGAC - fine grained access control or RLS - row level security).
    See eg http://builder.com.com/5100-6388_14-5062064.html and also Ask Tom http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:70287097313911 which refers to the documents.
    You can also implement a kind of VPD on the cheap by using user defined namespaces and the SYS_CONTEXT function, combined with application logic and clever view definitions.
    HTH
    Regards Nigel

  • Working with large database with multiple large tables ( orcale 11)

    Hi all,
    I'm trying to read and parse 3 tables:
    NetworkEvent - 500000 entries
    NewTrapEvent - 500000 entries
    NewTrapVlaue - 2000000 entries
    I I used 1 JDBC connection, 2 statements and 3 ResultSet( i used same statement for two queries).
    My questions are:
    ==========
    1. Is it reasonable? or should I add more connections? or more statements?
    2. Additionally when creating the Result Set I used the following parameters:
    ResultSet.TYPE_SCROLL_INSENSITIVE
    ResultSet.CONCUR_READ_ONLY
    and stmt.setFetchSize(1000)
    is it valid parameters? should the fetch be larger?
    is there any more important parameters that I missed?
    3. When setting the SQL command, I used each command to retrieve all the table entries:
    "select * from ana37.NetworkEvent order by detectiontime"
    Should I take partial entries in a loop? (for example 100000 in each loop) or is it ok for the Result Set to hold all of the entries( 2 milion)
    4. Can I clean the result set when I finished processing previous entries?
    thx
    Edited by: user9001513 on 06:59 23/11/2010

    Why don't you use a stored proc?
    Why are you ordering it?
    Should I take partial entries in a loop? Yep. Because software isn't perfect. No point in attempting to process the universe when you know it will fail sometime and it is easier to handle smaller failures than large ones (and you won't have to redo everything.)

  • Recapturing database design using designer6i

    We use designer as a tool to document our production database (basically use designer to store description for the tables and attributes). A promotion to the production database was made a while ago and we need to find a way to synchronize the repository and the production database.
    Does anybody know if we recapture the database design and retrofit table -> entity, will we lose all the descriptions already stored in the repository? Or is there a better way to do the synchronization?
    Thanks in advance

    Please check the Cameleon Open Source project at http://www.must.de/cameleon.html if ti fits your needs.

  • Database Design for Multiple function site

    Hi
    I am working on one project which involve multiple function
    site, such as
    Company Product Catelog, Customer Support Forum, Document
    Exchange Engine and
    etc...
    Normally we will combine ALL TABLEs into one DATABASE.
    My question are:
    1) Is my break them to individual DATABASE, will it perform
    better?
    Means Product Catelog and Forum will have different
    DATABASE, but they
    will using the same DOMAIN NAME.
    2) I am worried about the break down and corruption of
    DATABASE, so I have the
    idea to separate them out. Are my idea correct or wrong?
    3) I am seeking for better DATABASE DESIGN, because I know
    the database will
    become huge in future. I request for your idea and opinion.
    Thank you very much.

    Creating views: not an option I think. It would involve a lot of programming with 'instead of' triggers etc.
    Seperate databases: a good way if the locations are completely independant and do not share information. This involves more DBA work.
    Separate schema's in one database: this would make public synonyms impossible, and is probably not a good option.
    Adding a location id to tables: the best way I think, and flexible. You can easily add another location, and locations can easily share information.

  • Load Data from a table on one server's database, to the same table structure in multiple server databases

    Hi,
    I have a situation where i have to load data from one server/database table to multiple servers/databases.
    Example:
    I need to load data from dbo.TABLE_A  (on Server: Server_A & Database: Database_A)  to the same table on the list of server databases like
    Server: Server_B , Database: Database_B
    Server: Server_C , Database: Database_C
    Server: Server_D , Database: Database_D
    Server: Server_E , Database: Database_E
    Server: Server_F , Database: Database_F
    Server: Server_G , Database: Database_G
    Server: Server_H , Database: Database_H
    so on and so forth on 250 such server database combinations.
    The table structure is the same on all the servers.
    If i make the source or destination dynamic, it throws an error while mapping ?
    I cannot get Linked server permissions and SQL Server Config thing doesn't work as well.
    Please suggest on how to load data from one source to multiple server/databases.
    Thank you.

    I just need to transfer one table's data. its like i have to use a query to pick data for
    the most recent data. So i use something like, select A, B, C, D from dbo.table where ETL_TIMESTAMP > (the max(etltimestamp) in the destination on different server). There are no foreign key relationships and the data should not be truncated. it just had
    to append the new records.

  • Creation of Custom table in MII database.. Recommended?

    Hi All,
    In MII 12.0.6, I came with a requirement where I need to store some data in a table. As MII 12 runs on netweaver so naturally it has a associated database. Can we use that MII schema (or some new schema in that netweaver database) to create some custom table, to store some data. I am planning to connect that table by creating a IDBC connector and sql query.
    Thanks,
    Soumen

    I would not create a custom table in the same schema, but I see no reason why you couldn't create another schema in the same database server to hold your custom content.

  • OAF Update of Custom Table causing ORA-600 with database block corruption?

    Using OA Framework 12.1.3, running under EBusiness Suite 12.1.3
    Created Custom Web page operating against Custom Tables
    ISSUE
    On about 2% of new records, when OAF is UPDATING a record in a certain table, it  is failing with
    java.sql.SQLException: ORA-00607: Internal error occurred while making a change to a data block
    ORA-00600: internal error code, arguments: [kddummy_blkchk], [815], [26412], [6110], [], [], [], []
    ORA-06512: at line 1
    Before the DBA turned on 10.2.0.4.0 DB_BLOCK_CHECKING parameter, this actually
    resulted in corrupted data blocks in the database and corrupted indexes that
    eventually crashed the database and we had to do a full recovery with 2 days downtime.
    Now that we have turned on DB_BLOCK_CHECKING, it simply errors out and puts things
    in the alert log, but the records still fail to update as the writes are blocked.
    Then oddly, a few days later.. the records become editable.  And others fail.
    This is ONLY happening on the one particular table being updated by OAF.  Other custom pages
    posting to other custom tables are having no problems.   We've CTAS'd the table back and
    forth and recreated the indexes, and that did not help.
    Support says to post to the Forum  ( So I am! ) or hire Oracle consulting.. which doesn't make
    much sense given the error.  The Recovery Team that helped us in a separate SR ( we had
    to do db_repairs not just recovery ) felt it was an important problem the OAF team needed to
    strongly review.
    Anyone else encounter this already and know of a solution?
    TIA
    Karl

    After MANY hours of trial and error and research, we've identified ONE use case that seems to apply to 90% of the issue we have encountered.
    YMMV.
    The BC4J generated SQL which is generating the ORA-600 is
    BEGIN UPDATE XXRETURNHEADER ReturnHeaderEO SET INTERNAL_TEXT=?,LAST_MOD_USERNAME=?,OBJECT_VERSION_NUMBER=?,LAST_UPDATE_DATE=?,LAST_UPDATED_BY=?,LAST_UPDATE_LOGIN=? WHERE RMA_NUMBER=? AND ORGANIZATION_ID=? RETURNING TROUBLESHOOT_DATE, FAA_TAG_DATE, FAILURE_ANALYSIS_DATE, LAST_MOD_DATE, FAA_REVISED_DATE, TTE_TECH_SEND_DATE, TTE_REP_RESPONSE_DATE, TTE_REP_APPROVED, TTE_RMA_RANDOM_KEY, OBJECT_VERSION_NUMBER, LAST_UPDATE_DATE, LAST_UPDATED_BY, LAST_UPDATE_LOGIN INTO ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?; END;".
    We determined that if TTE_RMA_RANDOM_KEY was not a null value, we would get an ORA-600 error whenever we did an APPLY from the OAF Page to update the record.
    If we set that table attribute to NULL for the record using SQL.. then used the  OAF Page to APPLY.. it worked fine and the record saved without error.
    We then modified the EO to NOT   "Refresh After Update"  ( thus removing it from the RETURNING clause generated )... and even if the TTE_RMA_RANDOM_KEY
    had a value... the OAF Page APPLY worked and the record saved without error.
    I cannot identify anything from the User programming side that is wrong ( and neither could Oracle ), and it REALLY should be in the RETURNING clause list of
    attributes.. but this is the only workaround I've found that doesn't crash the Page and irritate the user to no end.
    I have reported my findings via the SR back to Oracle to do with it what they may... but it looks strongly ,to me, to be an error in the BC4J/JDBC/Database
    coordination and passing data between those black boxes.

  • Error in multiple operation with change document object for custom table

    hi all,
    I have developed a change document object for a custom table ZTEST and developed a report program for insertion, updation & deletion..everything works fine if I do only once ie. if I created only 1 entries. If I created 2 new entries , I am getting an Error "DUPREC:POS&Z3RL_TAB&Z3RL_TAB" and EXIT the transaction.
    why I am getting this error??? is it not possible to do multiple operation with the change document???
    kindly help.
    Edited by: JaiKarthik on Apr 7, 2010 6:20 AM

       LOOP AT ts_mod INTO wa_mod.
                READ TABLE <i_itab> INTO <wa_tab> INDEX wa_mod-row.
    * Select the existing entries in table Z3RL for change history
                    SELECT SINGLE * FROM z3rl
                           INTO wa_z3rl
                           WHERE vkorg   = <wa_tab>+3(4)
                           AND   zzkunnr = <wa_tab>+7(10).
    * Move the old entries
                    IF sy-subrc = 0.
                      CLEAR ls_z3rl.
                      ls_z3rl = wa_z3rl.
                    ENDIF.
    * Update the table
                 MODIFY (viewname) FROM <wa_tab>.
                   CLEAR wa_z3rl.
                    wa_z3rl-mandt      = <wa_tab>+0(3).
                    wa_z3rl-vkorg      = <wa_tab>+3(4).
                    wa_z3rl-zzkunnr    = <wa_tab>+7(10).
    * Populate change tables
                    CLEAR wa_change.
                    wa_change-teilobjid = 'Z3RL'.
                    wa_change-textart = 'TEST_2'.
                    wa_change-textspr = 'EN'.
                    wa_change-updkz = 'U'.
                    APPEND wa_change TO ts_change.
    *call the fM to log the values in CDHDR table.
                    CALL FUNCTION 'Z3RL_WRITE_DOCUMENT'
                      EXPORTING
                        objectid                 = 'Z3RL'
                        tcode                    = sy-tcode
                        utime                    = sy-uzeit
                        udate                    = sy-datum
                        username                 = sy-uname
                        planned_change_number    = ' '
                        object_change_indicator  = 'U'
                        planned_or_real_changes  = 'U'
                        no_change_pointers       = 'U'
                        upd_icdtxt_z3rl= 'U'
                        n_z3rl= wa_z3rl
                        o_z3rl        = ls_z3rl
                        upd_z3rl= 'U'
                        lv_opt                   = ' '
                      TABLES
                        icdtxt_z3rl= ts_change.
                CLEAR : wa_mod, <wa_tab>.
              ENDLOOP.
    Edited by: JaiKarthik on Apr 7, 2010 6:49 AM

  • Creating Custom Tables in the Portal Database

    Is there a way to create custom tables in the portal database in EP6?
    Thanks,
    Melissa

    Thanks for responding, Nick.
    We want to be able to display informational messages on the logon page before the user logs in.  Currently we make changes to several ASP files in EP5 to display the messages.  We want to be able to give privileged users the ability to enter the message, enter start/end date, etc.  We want to do this in EP6 as well.

  • Tools for capture database design based on multiple  schema

    My database is 11.2.0.1
    please suggest me a tools to capture database design.
    i tested toad,but this tools only capture based on table!

    sql developer data modeller.
    http://www.oracle.com/technetwork/developer-tools/datamodeler/index.html

  • Synonym required to query custom tables from Oracle Apps database

    When creating an Answers report that queries from a table owned by a custom schema (not APPS), I cannot query the table and get error. Once I add a Synonym for APPS on this table, then OBIEE works normally.
    Since OBIEE is logging in as the APPS user, are Synonyms required for all non-APPS tables/views or is there another feature of the Administrator where it can store the table alias (our typical owner of custom tables is XXFI)?

    OK, well "compare" can mean one of two things: Compare structure or compare contents. Here is a quick script to compare column structures of two tables on one database:
    (select COLUMN_NAME,
    DATA_TYPE,
    DATA_LENGTH,
    DATA_PRECISION,
    DATA_SCALE,
    NULLABLE
    from dba_Tab_columns
    where owner=:OWNR1
    and table_name = :tablename
    minus
    select COLUMN_NAME,
    DATA_TYPE,
    DATA_LENGTH,
    DATA_PRECISION,
    DATA_SCALE,
    NULLABLE
    from dba_Tab_columns
    where owner=:ownr2
    and table_name = :tablename)
    union all
    (select COLUMN_NAME,
    DATA_TYPE,
    DATA_LENGTH,
    DATA_PRECISION,
    DATA_SCALE,
    NULLABLE
    from dba_Tab_columns
    where owner=:ownr2
    and table_name = :tablename
    minus
    select COLUMN_NAME,
    DATA_TYPE,
    DATA_LENGTH,
    DATA_PRECISION,
    DATA_SCALE,
    NULLABLE
    from dba_Tab_columns
    where owner=:ownr1
    and table_name = :tablename)
    If this query returns any rows, then these indicate that there are structural differences between the tables. We do a minus in both directions to ensure that an additional column in either schema will be returned in the query.
    If you are going across dblinks to remote tables then you have to amend the "dba_tab_columns" to "sys.dba_tab_columns@yourdblink"
    If you also want to compare indexes, triggers, etc then do the same sort of thing for the associated dba_ views for those objects.
    And if you want to compare table contents, then often the fastest way is also to check minuses in both directions, if the tables are not too big:
    e.g.
    (select * from schema1.table@dblink1
    minus
    select * from schema2.table@dblink2)
    union all
    (select * from schema2.table@dblink2
    minus
    select * from schema1.table@dblink1)
    local tables, of course, simply omit the "@dblink" issues.
    There are tools to help in such things. TOAD, for example, has a pretty good schema comparison tool, and there are plenty of other options out there. But if you need to script this yourself then the logic I've shown is a good starting point.
    Cheers,
    Mike

Maybe you are looking for