Designing Database Tables

Hi,
Let's assume we have to develop an application for a bank.
There are different types of Accounts in a Bank. ex: Fixed Deposit Accounts, Current Accounts, Savings Accounts
There is also the possibility of adding new account types.
How should we design the database.
Have one Table to store common account data and three more tables to store data of 3 account types?
But I will have to create a new table and amend my code to access new table if I add another type of account.
Another method I thought of is to use a table to store configuration data.
AccountConfiguation Table:
Account Type Column Id Column Desc
=========== ====== =========
And add column details for each table.
Then have one main table to save details of all 3 account types.
AccountDetails Table
AccountID Column Id Data
========= ========= =====
Please help me to identify the best method or is there any other way.
Best Regards,
Chamal.

You are in danger of straying into the big mistake that is Entity-Attribute-Value (EAV). You don't want to go there.
Yes, you'd have to amend your code if you introduced a new account type. Surely you'd have to do that anyway if it had new attributes?
If there aren't too many account types or too many columns altogether, you could simplify to a single table with all common and type-specific columns. The type-specific columns would be NULL for other types and check constraints would be used to ensure the appropriate columns were used for the account type.

Similar Messages

  • Best Practice for Designing Database Tables?

    Hi,
    I work at a company for tracking devices (GPS Devices). Our SQL Server database is designed to have a table for each device we sell, currently there is 2500 tables in our database and they all have the same columns they only differ in table name. Each device
    sends about 4K records per day.
    currently each table hold from 10K records to 300K records
    What is the best practice to design a database in this situation? 
    When accessing database from a C# application, which is better to use, direct SQL commands or views? 
    a detailed description about what is best to do in such scenario would be great. 
    Thanks in advance.
    Edit:
    Tables columns are:
    [MessageID]
          ,[MessageUnit]
          ,[MessageLong]
          ,[MessageLat]
          ,[MessageSpeed]
          ,[MessageTime]
          ,[MessageDate]
          ,[MessageHeading]
          ,[MessageSatNumber]
          ,[MessageInput]
          ,[MessageCreationDate]
          ,[MessageInput2]
          ,[MessageInput3]
          ,[MessageIO]

    Hello Louis, thank you so much for your informative post. I'll describe in detail what situations I came through my 9 months of work in the company (working as a software engineer, but I am planning to take over database maintenance since no one is maintaining
    it right now and I cannot do anything else in the code to make it faster)
    At every end of the month our clients generate report for the previous month for all their cars, some clients have 100+ cars, and some have few. This is when real issue start, they are calling their data from our server through internet while having 2000
    unit sending data to our server, they keep on getting read time out since SQL Server gives priority to insert and hold all select commands. I solved it temporary in the code using "Read Uncommitted" once I initialize a connection through C#. 
    The other issue is generating reports for a month or two takes lots of time when selecting 100+ units. Thats what I want to solve, the problem is the one who wrote the C# app used hard coded SQL Statements
    AND
    the company is refusing to upgrade from SQL Server 2003 and Windows Server 2003. 
    Now talking about reports, there are summary reports, stops reports, zone reports ..etc most of them depend usually on at least MessageTime, MessageDate, MessageSpeed, MessageIO and MessageSatNumber.
    So from your post I conclude that for now I need to set snapshots so that select statements don't get kicked out in favor for insert commands, but does SQL Server automatically select from the snapshots or do I have to tell it to do so? 
    Other than proper indexing what else I need? Tom
    Phillips suggested Table partitioning but I don't think it is needed in my case since our database size is 78GB
    When I run code analysis on the app, Visual Studio tells me I better use stored procedures, views than using hard coded Select Statements, what difference will this bring me when talking about performance?
    Thanks in advance. 

  • Design Database

    What are the different approaches to solve this problem?
    Design database tables to mimic hierarchical file system.  (e.g. drives, directories, files, include common properties like name, read-only, size, created date). 
    a)      Name the database “Interview_FirstnameLastName”.
    b)      Design should support files in root of drive or any number of levels down.  (e.g.  c:\test.txt, d:\test\text.txt, c:\test\test\text.txt, etc.)
    c)      Create a script to insert test data into tables.  Should have at least 25 files.  Alternatively, create process to take a base path and populate the database by traversing a directory tree.
    d)      Provide scripts to create tables, relationships, indexes or a backup of the database. 
    e. Write a stored procedure (usp_FileSearch) that takes 1 text parameter (@criteria).  It should return a  data containing all the files defined whose filename contains @criteria.
      Return file ID, full path, file name, read-only, size, created date)

    Hi,
    840992 wrote:
    I am using Oracle 10.2
    I was trying to create 3 tables with below columns and constraints.  I wanted to know if these tables work, then I  will use the CONNECT BY queries to get the data
      tblDrive (DriveID,Name)   -   DriveID is the Primary Key
      tblFolders -  (FolderID, Name, FolderLevel, DriveID) -  FolderID is the PK and DriveID is the Forgein Key
      tblFiles (FileID,FileName, FullPath, ReadOnly, Size, CreatedDate, FolderID) -  FileID is PK and FolderIDis the FK
    Once again, I think one table would be a better design, but if you really want to create 3 tables, I'm sure that won't get you an F in the course.  Having 3 tables will make CONNECT BY queries more complicted; you'll need to do UNIONs and/or joins every time.  I would create just one file, that looks pretty much like the Files table (as mentioned above, starting every table name with tbl isn't a very good idea) you sketched above.  ParentID would be a better name than FolderID.  If some of the columns do not apply to folders or to drives, then simply leave them NULL.  (However, don't ReadOnly and CreatedDate apply to folders as well as files?)
    If you do create 3 tables, you'll need a ParentFolderID column in Folders, since folders can contain other folders.  Also, I would not store FolderLevel or DriveID in the folders table.  In a file system, you should be able to move a folder, and all its sub-folders, from one drive to another, or from one level to another easily.  You don't want to go through the tree changing all those rows every time a folder moves.  For the same reason, I wouldn't store FullPath in the Files table.  You can get it using the SYS_CONNECT_BY_PATH function whenever you need it.

  • Design an uix page which is not related an database table

    Hi;
    I want to design a uix page, but this page elements is not related an database table, only pass through the parameter to run a report, how can i do this easly
    Thanks

    Such functionality is not generated/supported by JHeadstart. But you can build this page manually using JDeveloper. Please use the JDeveloper online help and/or the JDeveloper forum for help if you get stuck.
    In monitoring this forum we have to set priorities, and we simply lack the resources to help you with questions not related to JHeadstart. I hope you understand this.
    Steven Davelaar,
    JHeadstart Team.

  • Database Table cannot be found when Verify Database

    Post Author: brentlaw
    CA Forum: Other
    I have been using CRW 7 for many years.  I recently upgraded to XI (I have current version).  I can open existing reports and create new reports fine.  The problem is when I Verify Database I get an error message "The Database table <tablename here> cannot be found. Remove this table from the report". 
    This happens to all existing and new created reports.  The data fills correctly when previewing.  The problem only occurs when Verifying Database. 
    I thought it might be an ODBC driver problem so I upgraded my driver to v 3.525.1117.  At least I think I upgraded it I did not check the version before I installed SQL 2005 SP2.  After installing SP2 it seemed to be fine but a week later the problem came back.  Mysterious eh?
    I am trying to launch a report from VB6 using RDC and rpt file.  I get logged in correctly but at .viewreport I get a generic error message.  I am assuming the problem is related the the issue I raise in this forum post.

    Post Author: brentlaw
    CA Forum: Other
    I fixed the problem.  In CR XI Developer Designer window I opened up Database-SetDataSourceLocation.  I noticed that in "Properties" the last item "Use DSN Default Properties": was set to True.  I changed this value to False.  Now this problem is solved.
    I am Not using Windows Authentication I am using SQLServer authentication.  In my code I was passing SQLServer Authentication credentials. 
    I opened up all of my CR 7 reports in CR XI and changed this setting on both the Main and the Subreort property in the SetDataSourceLocation dialog box and now all my reports work.  I am a happy camper.
    I don't know if this is a CR 7 conversion to CR XI only situation or not.  Hope this information helps someone else.

  • How to get a graphical overview of my database tables

    I am looking for a tool to get a clear overview of my database tables.
    the db structure is fairly simple at this moment, and I only need to see the tables with their "links" (foreign keys).
    I was not able to find such a tool in the enterprise manager package.
    thanks a lot for any help
    Pascal - Gent, Belgium
    [email protected]

    Oracle Designer will allow you to reverse engineer an ERD from an Oracle database. I don't know of any reason why it wouldn't work with 8i Lite.
    There are also other products which work with multiple database types. I recall ERWIN was such a product.

  • How to make data entries in a database table field as a hyperlink?

    Hello all,
    I am designing an application in BSP. The requirement is to  make some of the entries in the database
    tables as hyperlink values.
    I have a database table which has a field "country feature". The scenario is  that the user can enter any value in this field through view. The value can be a hyperlink or a free text, depending on the user requirement.
    Is there any way by which the user can enter hyperlink values in the particular field in a database table?
    Thanks in advance for your help.
    Gurmahima.

    Hey Gurmahima ,
    This is sample code for Selecting and deselecting all the checkboxes .
    All you have to do is Set a pf-status and follow the code logic .
    Here w_check is the check box field , w_line is the line your raeding and w_lines is the total number of lines(entries ) you have in table .
    set pf-status 'SELECT' .
    case sy-ucomm .
        when 'SELECTALL' .
          set pf-status 'SELECT' excluding 'SELECTALL' immediately.
          w_line = w_line + 3  .
          do w_lines times .
            read line w_line field value w_check .
            if w_check = space .
              w_check = 'X' .
              modify line w_line field value w_check.   
              add 1 to w_line .
            endif .                        " IF W_CHECK = ' '
          enddo .                          " DO W_LINES TIMES
          clear w_line .
        when 'DESELECT' .
          set pf-status 'SELECT' excluding 'DESELECT' immediately.
          w_line = w_line + 3  .
          do w_lines times .
            read line w_line field value w_check .
            if w_check = 'X' .
              w_check = space .
              modify line w_line field value w_check .
              add 1 to w_line .
            endif .                        " IF W_CHECK = 'X' .
          enddo .                          " DO W_LINES TIMES
          clear w_line .
    Hope you get it!
    Much Regards ,
    Amuktha .
    Edited by: Amuktha Naraparaju on Feb 5, 2009 6:22 AM

  • Auto Incrementing a field in a database table

    Hello All,
    I have created a database table for generating a unique ID, based on two key fields; Product and Area.
    For a particular Product and Area,the ID generated should be unique, and it will be the third field of my table.
    Is there any possible way by which i can generate the ID automatically,based on the Product And Area entered? The ID should also be automatically incremented based on the next entry.
    Can anyone help me in resolving this problem?
    Also, if i am deleting a particular Product and Area, will it be possible to remove the ID generated by it?
    Thanks In Advance.
    Shino.

    Hi,
    If you are using a generated maintenance screen and populating the data manually your approach will need to be different.
    It could be possible to use a user exit in the generated screen to populate your ID field, but you will face the risk that the user will be able to presumably over-type the ID or enter their own value.
    Consider your overall requirement and design, it may be that a generated maintenance sceen is not the most suitable way to build this functionality.
    Regards,
    Nick

  • Database Table Resource - What does it actually do?

    Hi,
    I want to know what it actually means to grant a database table as a resource to a user in IDM.
    For E.g.: When I provision a NT resource to a user using IDM, it means that a Windows NT account is created for that user.
    However, when I assign a Database table as a resource for a user of IDM, it does not create a user account for that user.
    I am using mySql, and I have assigned a DB table as a resource for a new account. However, I find that such a user is not created in mySql. What does that mean? How then does this user access that database table?
    I was under the impression that a user account would be created in mySql having privileges for that table. In effect, a SQL statement like "Grant all privileges on <tablename> to <username> ".
    Thanks in advance.

    If you want to create or edit mysql users, you would use the MYSQL resource adapter, not the Database Table adapter. The database table adapter is designed to manage rows of a table within the database. Neither allow arbitrary SQL to be excuted, but you could make SQL calls via express in your form or workflow.

  • Listen to a database table (inserts, deletes etc)?

    Hi,
    is there a chance to listen for a database table for updates?
    The programm should not stress the system. I'm looking for something like a listener in JAVA.
    Thank You!

    Wow! Two development systems, a dream for many! I now see your dilemma. I don't think this can be resolved by an IT solution. You need a project management solution. Your project managers who oversee the developers and configurators on both systems should come up with a strategy of not to step on each other toes. Let us say one works on SD configuration on one system and other works on MM configuration on another. That way they will not be doing the same thing. Then there will be those touch/integration points where there should be clear cut guideline as to who does what. As far as developers are concerned, they should also have clear naming standards and should follow them.
    I am curious as to why you have two development systems. Will it not lead to duplication of work(as you see now). Then there will be the problems of one overwriting the work of others. Even if two seperate projects are in development on two different boxes, if both need to configure the same activity but different way, will it not lead to one overwriting others work?
    How are you keeping the two development environments in sync with each other? Is the purpose of two development environments is to do independent developments or is it to just provide more bandwidth and power. If it is the second reason, then have you tried a landscape similar to most production systems, where there will be multiple servers working, yet sharing the same database(distributed architecture)? If it is the first, then proper guidelines and naming standards should avoid most of those situations.
    Even, the enqueuing strategy you are looking for will be difficult to design. If you look at SPRO, there are at least 100 tasks that you can do there, and some thousands of tables will be there behind those tasks, so how are you design your enqueue table, by task or by individual table? Add to the mix the development objects, it becomes even more complicated and don't forget basis and security changes. If you design your enqueue table based on the transport objects, it will be difficult to know the content of the transport, excepts at a metadata level. Also, can you imagine how much space this table(s) going to take up?
    So many questions, but no answers. A technical solution is not necessarily always the best solution, even though I am technical person!!! Either your scope should be very limited to do such a thing, or you should tackle it with non-technically, standards, procedures and guidelines.
    Regards,
    Srinivas

  • No primary key in database table.Need help with ODS keys.

    Hi ,
    I am pulling data from a database table where there in no primary key . So when I designed my ODS and loaded the data , the records got overwritten...(If there are 5000 records only 4000 got transfered) . So Now the only option I can think of is putting all the database fields as key fields in my ODS but then I am restricted to only 16 fields for ODS and I have more than 24 fields in my database table.What should I do now.Any help will be appreciated.
    Thanks a lot!!!

    Hi,
    are you trying to pull data from structures.....putting all the fields in the key fields is the ODS keys is not a solution.
    what is your reporting requirement....try to maintain the keys for which you want to see the data
    e.g. if in report you want to see the data for sales order then put the keys as sales order for ODS...so that the data is correct at the sales order level.
    ie. the try to maintain the ODS at the level ...which can be used.
    This is the just a guide....you can decide with your requirement.
    Thanks

  • Designing a table for high rate of concurrent inserts and selects...

    I am looking for some recommendations on designing a table the will be inserted into from both nodes of a 2 node cluster quite heavily during peak hours when we are taking alot of orders. We are an online store and we are designing a table that will be used to hold product sku's for items that are placed in a shoppers cart at the same time and then we plan to use this table as a way of subtracting the inventory in this table as a minus in a view of our true nventory quantities?
    Not sure if that was clear but basically this table will be getting hit heavily for inserts and at the same time we will be using the data in the table to select from it so we can subtract the shu's that exists in the table.
    I am looking for techniques that maybe some of our guru's have implemented in this type of design in a rac environment that will help in the conncurrency that we are expectiing.
    Should I be building my tables with the smallest block size available as to avoid hot block in the db buffer cache and also we are using a sequence to generate and ID on the table and I have set a large cache size on the sequence (5000).
    We are planning on using ASSM table spaces with auto extent and segment space management as everthing we have read indicated that this is the best type of tablespace mgmt in RAC.
    What other factors should I be considering.
    any help or suggestions are greatly appreciated.
    Thanks in advance.

    user520056 wrote:
    I am looking for some recommendations on designing a table the will be inserted into from both nodes of a 2 node cluster quite heavily during peak hours when we are taking alot of orders. We are an online store and we are designing a table that will be used to hold product sku's for items that are placed in a shoppers cart at the same time and then we plan to use this table as a way of subtracting the inventory in this table as a minus in a view of our true nventory quantities?
    Not sure if that was clear but basically this table will be getting hit heavily for inserts and at the same time we will be using the data in the table to select from it so we can subtract the shu's that exists in the table.
    I am looking for techniques that maybe some of our guru's have implemented in this type of design in a rac environment that will help in the conncurrency that we are expectiing.
    Should I be building my tables with the smallest block size available as to avoid hot block in the db buffer cache and also we are using a sequence to generate and ID on the table and I have set a large cache size on the sequence (5000).
    We are planning on using ASSM table spaces with auto extent and segment space management as everthing we have read indicated that this is the best type of tablespace mgmt in RAC.
    What other factors should I be considering.
    any help or suggestions are greatly appreciated.
    Thanks in advance.See my .sig for other questions you should answer - OS, DB (version &c.),
    CPU/RAM/Disk...
    If you're running this on a 386 with 16 MB of RAM with on HDD, then you could
    have problems - if you're running it on something different, well that changes
    the possible answers.
    Paul...
    When asking database related questions, please give other posters
    some clues, like OS (with version), version of Oracle being used and DDL.
    Other trivia such as CPU + Disk configuration might also be useful.
    The exact text and/or number of error messages is useful (!= "it didn't work!"). Thanks.
    Furthermore, as a courtesy to those who spend time analysing and attempting to help,
    please do not top post and do try to trim your replies!

  • How to design a table?

    Hi,
    I need to list some data out of a database...
    So I was wondering if it's possible to design a table to put the data clearly arranged on the screen.
    thank you.

    Hi mastix
    It is possible to design a table using midp2.0 with the class CustomItem.U can find the readyMade example named in UIDemo in apps folder of the WTK2.0 tool kit installed path
    Ravi

  • How to implement a page showing different database tables

    I am wondering what is the best way to implement the following task:
    On the left side of a page, there are two Listboxes. On the right side of the page, I want to display different database tables depending on the selected value from those two Listboxes.

    I am wondering what is the best way to implement the
    following task:
    On the left side of a page, there are two Listboxes.
    On the right side of the page, I want to display
    different database tables depending on the selected
    value from those two Listboxes.A Data Table component isn't really designed to dynamically swap which database table you're binding too (and therefore which set of columns you will display) under the covers. Here are a couple of general strategies to consider for accomplishing your functional requirements:
    * Create a separate Data Table component for each possible database table, all on the same page, and dynamically set the "rendered" property of the selected Data Table to true, while setting it to false for all other Data Tables. That way, only the corect one will be shown.
    * Create a separate page for each Data Table, using a similar look and feel so that it appears to the user like it's all the same page. To save cutting and pasting the list components, put them in a JSP Page Fragment so they can be reused on each page. ((SIDE NOTE: This is a very common technique for simulating what looks like tabbed panes, but where the implementation actually uses separate pages.))
    * Use frames so that the left frame (containing the list boxes) stays the same, and the right frame switches to a different page for each of the tables. This is essentially another way to share the list components across the pages.
    * Abandon all the ease-of-use stuff Creator provides for binding to data tables, and write code that programmatically erases all the old child components and creates new ones. This is the sort of thing you'd need to do for a "SQL BROWSER" sort of application, where the set of columns is not known ahead of time.
    Craig McClanahan

  • Create database tables from an xsd

    Is it possible to generate database table from a given xsd using toplink ?
    I want to use these tables to persist java objects obtained by unmarshalling the xml (corresponding to this xsd).
    Thanks in advance,
    Mahima

    Hello Mahima,
    Although you could use TopLink to generate a database schema from an XSD using a combination of wizards available in the TopLink Workbench, the resulting database schema would probably not be an optimal design. If you're interested we can talk about how to use this approach as a guide.
    Is your main use case the generation of a database schema or the actual movement of database data to/from XML?
    Using a combination of TopLink's object-relational and object-XML support to move data between XML and a relational database is a valid pattern. Refer to the discussion thread below for some approaches at setting up the metadata.
    TopLink-JAXB : Creating and Mapping tables from Toplink-JAXB POJOs.
    -Blaise

Maybe you are looking for

  • I need a script that can save images in whatever directory they reside in

    I am working on a project where I have over 1500 directories that have multiple .TIF images in each one. I am looking for a solution where I can run a script (which may or may not call on actions) that allows me to save each .TIF as a .PSD and again

  • Help with importing video from digi camera

    Hey guys, we made a short movie on the spur of the moment so we just used my digital camera and when I plugged it into the computer it would only show up in iPhoto obviously. But I imported the movies into iPhoto and then I was hoping to import them

  • Initial parameters

    Hi, is it possible to set initial parameters like optimizer_index_caching or optimizer_indedx_cost_adj for a single schema (Oracle 10g)? Or are this parameters valid for the whole DB ? If yes, can someone tell me please how I can set this ? thanks in

  • Re-install CS5.5

    I want to re-install my CS5.5. What will be the procedure?

  • How can I import .pdf forms into RoboHelp 11.0.3.268 without garbling fields?

    When I try to import .pdf forms into RoboHelp 11, the fields get garbled. Is there any way around this?