473,770 Members | 4,029 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Designing a SQL Database For Predetermined Accounts And Possible Write-ins

7 New Member
I'm trying figure out the best way to deal with the following situations:

This scenario is oversimplified for the sake of the question. Let's say I have 3 tables: Transactions, Accounts and Designations.

Transactions table has an primary key called Trans_TransId and keeps track of all contact information associated with a transaction.

Accounts table contains a list of predefined accounts. It has a primary key called Acc_Code and a description column named Acc_Val

Designations table is a relations table which consists of a Trans_TransId, referencing a primary key from Transactions table, Acc_Code referencing a primary key from Accounts table, and Des_Amount which is an mount designated to a particular account for that transaction. This table allows for multiple designations to different accounts to be made per transaction (Trans_TransId).

This design accommodates situations in which the user uses only predefined accounts from the list. However, I also need to accommodate a situation in which the user would like to designate an amount to a certain account that's not in the the Accounts table and for which he/she will provide a description via a text box.

In your opinion, what's the best way to design this database in order to accommodate for those custom accounts?
Aug 19 '10 #1
13 1506
NeoPa
32,573 Recognized Expert Moderator MVP
For the integrity of your overall data, I would suggest maintaining all this data in the tables anyway. Certain elements may appear transitory and unimportant at the time, but the underlying data will not be inherently referential if transactions are stored pertaining to accounts that are not.

I suspect you may nevertheless need to consider the more permanent accounts differently. In that case you can introduce a flag into the table to indicate whether the account is considered permanent or transitory.

If the data isn't stored you get problems where a report/query including the transactions alone returns values whose total is A, yet a report/query on the same data, but including the linked Account information, returns a value of B.
Aug 19 '10 #2
alkos333
7 New Member
I can't maintain all of these accounts as there are way too many and we don't want all of them to be displayed for the user to choose from. We do want to give them an option to write their own in that we can late manually match to an appropriate account. I just want to figure out the best way to deal with these write-ins.
Aug 19 '10 #3
NeoPa
32,573 Recognized Expert Moderator MVP
alkos333:
I can't maintain all of these accounts as there are way too many ...
Too many for what. I find it hard to conceive of there being too many for SQL Server to handle.
alkos333:
... and we don't want all of them to be displayed for the user to choose from.
That can easily be handled by the flag to differentiate those accounts which are official and those that you refer to as write-ins.
alkos333:
We do want to give them an option to write their own in, that we can later manually match to an appropriate account. I just want to figure out the best way to deal with these write-ins.
Excuse my rewriting your quote. I felt it would help to understand what you were trying to say.

This is new information of course. I think, on reflection, I would still recommend the same approach, but if you are doing later manual matching, then any temporary accounts that no longer have anything tied to them could be pared from your table.

This new information also means that the chances of being overrun by temporary accounts are reduced enormously to the point that it's hardly worth considering as an issue (even if you felt it was before).
Aug 19 '10 #4
ck9663
2,878 Recognized Expert Specialist
Ideally, you can have another column on your Account table to identify which ones are (your) internal codes and which ones are user-defined. On your GUI, display only those that are internal codes and yet you still have the user-defined on your table. If you have (and you should) an referential integrity checks on your Transaction table with respect to the Acc_Code , you will be able to keep your data relationship and keep the data that you need.

Good Luck!!!

~~ CK
Aug 19 '10 #5
alkos333
7 New Member
I apologize for the lack of information. Maybe the following will clarify things a bit:

I have all possible accounts stored in the database. There around around 2000 of them. I have also set a bit to determine which ones to display to the user.

Obviously we don't want to overwhelm the donors with all these accounts. Hence, we display only the most common ones. However, we still want to give them an alternate way of specifying an account that's not displayed and that's why there is this text box in the UI which would allow them to do so. I'm just trying to figure out the best way to store these so-called "write-ins."

Hope this has clarified things a bit. Once again, my apologies for ambiguity.
Aug 19 '10 #6
ck9663
2,878 Recognized Expert Specialist
Thinking more of keeping the referential integrity of your tables, I'd still say you keep it in the same table.

Happy Coding!!!

~~ CK
Aug 19 '10 #7
alkos333
7 New Member
That makes sense. Currently Accounts table's primary key is a 6-character field. That's because this database is just a temporary storage and I'm using the types defined in our primary database. Therefore, for the "write-in" accounts, I can set this field to something like "user" and add another column which would be of type GUID and would serve as a primary key for the entire Accounts table. What do you think?
Aug 19 '10 #8
NeoPa
32,573 Recognized Expert Moderator MVP
That's a good question.

I would consider making an effort to keep the current index field as unique, even if that becomes somewhat tricky (and it may well do so). There is a benefit to having that as a constraint for new data. That said, if you're absolutely certain all possible accounts are already entered, obviously at this stage all uniquely, then your suggestion may be appropriate for you. I don't want to steer you towards a solution that ends up limiting your choices down the line though.

One of the problems associated with keeping the current PK would be the fact that, even removing redundant records when the transaction has been 'properly' assigned, will still leave the process eating through the limited available list of usable codes. Obviously the PK field would need to be assigned automatically for the unofficial records, and this normally relies on adding one to the current maximum (one way or another). Thus the possibility for losing chunks of the available values and, in time, running out - even though by that time there would still be many gaps earlier in the sequence from subsequently deleted records. I think this could probably be got around, but it would at least be fiddly, if not downright complicated.
Aug 19 '10 #9
alkos333
7 New Member
Alright, quite a lengthy reply there :). So basically, you support my idea of using a GUID, correct?
Aug 19 '10 #10

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

Similar topics

2
3939
by: Fran Tirimo | last post by:
I am developing a small website using ASP scripts to format data retrieved from an Access database. It will run on a Windows 2003 server supporting FrontPage extensions 2002 hosted by the company 1&1 with only limited server configuration via a web based control panel. My query relates to the ASP security model and how it relates to FrontPage options for setting file access on a database file. If you know of any online documentation...
0
1155
by: BUX | last post by:
I have myDB with myForm1 and myForm2. MyForm1' s code call myFunction() in a library database. MyFunction have to call myfForm2_AfterUpdate MyfForm2_AfterUpdate is declared as public. Eval(form_MyfForm2_AfterUpdate) work only in myDB , but not in library database. I would like to use CallByName() function, but i do not how to set the
3
1737
by: Jarod | last post by:
Hey I would like to write a database class. Let's say it would work like this: datareader GetDataReader(string sqlquery); This would be static, so I could do this: datareader dr = myclass.GetDataReader("SELECT * FROM table); But in this function I would have an open connection how to close it ? I return dr, does it create a new object or gives me a reffernce to existing one ? It's done like this : return dr; so ... ? Maybe you will...
7
4454
by: Andy | last post by:
Hi, I have a complicated question that I'm hoping someone can help me out with. I have a webpage that contains a plug-in. This plug-in can communicate/pass data with the webpage that contains it via javascript. What I need to be able to do is take that data passed via javascript and, using vb.net as the code behind language, send it to a database without posting it because when I post, the plugin is reloaded and starts at the beginning....
1
1519
by: booner | last post by:
As I create tables, establish relationships (i.e. no data yet) - the size of the .mdb file continues to grow. So I have ~ 20 tables several relationships .. BUT NO DATA ... and the file is up to 11 meg (early on it was very small - then a few changes later - up to 3 meg. More changes and now up to 11 meg). It seems as if the changes are being stored or some such thing? What is leading to this size growth? Any and all...
2
1940
by: occyink | last post by:
I run a website selling cartridges. My stock on the website is in a MySql database. My accounts package and invoicing software runs on an Access database. In my website databse there is a table called products, on my accounts Access database there is a table called items. I am trying to link certain fields in MySql database with certain fields in Access database. The reason for this is so when I update the price in the accounts database (access)...
2
1359
by: Łukasz Ledóchowski | last post by:
Hi! I want to develop database web application. It will consist of many similar webpages with grid and ability to edit, insert or delete rows. All of these webpages will have grids with the same properties, ability to export data to excel or pdf, the same buttons (edit, insert, delete, export, print). What I want is to write code only once and use it in every page. In Delphi, where I usually code, I would create base class with all of...
1
1238
by: warezguy05 | last post by:
Hi I'm developing a database driven website (my first one..) but i've run into a problem. My vision: The website should contain a database of DJ's that have played SETS at EVENTS (or raves ..whatever you call them). Each of those sets should contain a downloadlink to an audiofile so the visitors of the website are able to listen the set at home. Every set consists out of a certain amount of TRACKS (id, artist, title, remixer)
1
2088
by: whiteyoh | last post by:
Hi All, I have just started learning java. I have a good understanding of UML 2. What i am trying to do is to make a small user authentication applet. I have completed all of the relevant connection requirements via administration in XP but i just need a little helping hand to nudge me along. The following script works fine, but I need some direction as to how to modify it to become an applet and to display something other than "1". ...
1
1056
by: bluemoon9 | last post by:
on the form, there is a command Print with 3 options, when I click on each option, it print the form assinged to the option; however, when I go to the back end of the database and view "report" tab, I do not see these reports, is it possible that these reports have been set under hiden mode? is there a way to see these report list in the report tab? thanks! Private Sub cmdPrint_Click() If fraFormType.Value = 1 Then ...
0
9439
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10237
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8905
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3987
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2832
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.