Should discount on invoice items and entire invoices be negative line items or separate properties of an invoice?
In a similar question, Should I incorporate list of fees/discounts into an order class or have them be itemlines, the asker focuses more on orders than invoices (which is a slightly different business entity). Discount is pr...
Here is my actual table schema (I'm using Mysql) :
Table experiment :
code(int)
sample_1_id
sample_2_id
... until ... sample_12_id
rna_1_id
rna_2_id
... until ... rna_12_id
experiment_start
How can I optimize both part : sample_n_id and rna_n_id (all are bigint(20) and allow null=true) ?
About values : we can have : ex :
sample_1_id ...
I need to make article that cannot be edited, but it can be saved as a new version and only the newest version is shown to users. How should I implement this kind of database design?
...
Hi,
I have to add functionality to an existing application and I've run into a data situation that I'm not sure how to model. I am being restricted to the creation of new tables and code. If I need to alter the existing structure I think my client may reject the proposal.. although if its the only way to get it right this is what I will...
Whenever there is a many-to-many relationship, I think there will be immediately a many-to-many table needed (also called a junction table). Is there any advantage of using special naming convention for these tables, as opposed to the other 1 to many tables? Or are there popular special naming conventions used by companies designing da...
When we design a database table for a DVD rental company, we actually have a movie, which is an abstract idea, and a physical DVD, so for each rental, we have a many-to-many table with fields such as:
TransactionID UserID DvdID RentedDate RentalDuration AmountPaid
but what about with virtual goods? For example, if we le...
Database newbie here. I'm setting up a mysql table. One of the fields will accept a value in increment of a 0.5. e.g. 0.5, 1.0, 1.5, 2.0, .... 200.5, etc.
I've tried int but it doesn't capture the decimals.
`value` int(10),
What would be the smallest type that can accommodate this value, considering it's only a single decimal.
I...
Guys,
I would love to here your ideas on this. I am creating a table which will store weekly shift hours for employees.
for example: Jon works 9:00am to 9:00pm Monday , 10:00 AM to 5:00PM on Tuesday, etc.
How should I go on designing this table? I thought of 2 options.
(1) For every record I can have two lines for AM and PM and have ...
I'm a database newbie designing a database. I'll use SO as an example because it's easier to ask it on something that you can see already, but it's not the same, it will just help me understand the right approach.
As you can see, there are many questions here and each can have many answers.
How should I store the answers in a table?
S...
I'm trying to learn good relational database design (using mysql and php if that makes any difference). I've already done some database work, so I'm not totally clueless, but I suspect that my solutions may not have adhered to best practices for efficient searching, optimization, etc.
Can someone suggest a good set of videos on the top...
I'm designing a product database where products can have very different attributes depending on their type, but attributes are fixed for each type and types are not manageable at all. E.g.:
magazine: title, issue_number, pages, copies, close_date, release_date
web_site: name, bandwidth, hits, date_from, date_to
I want to use InnoDB and...
Our web application allows users to upload photos, it uses a PHP script on a LAMP server running on Amazon EC2 to handle image uploads, Amazon S3 to store the files and a MySQL database for recording data about the image (user id, filename, tags etc).
I intend to have an image_uploads table in the database with a colum for each month an...
I need a sparse table which contains a set of "override" values for
another table. I also need to specify the default value for the
items overridden.
For example, if the default value is 17, then foo,bar,baz will have
the values 17,21,17:
table "things" table "xvalue"
name stuff name xval
---- ----- ---- ----
foo ... ...
We are designing database schema for a new system based on Oracle 11gR1. We have identified a main schema which would have close to 100 tables, these will be accessed from the front end Java application.
We have a requirement to audit the values which got changed in close to 50 tables, this has to be done every row.
Which means, it is...
I'm implementing a table per subclass design I discussed in a previous question. It's a product database where products can have very different attributes depending on their type, but attributes are fixed for each type and types are not manageable at all. I have a master table that holds common attributes:
product_type
============
pro...
I've read all the SO questions, the Coding Horror articles, and Googled my brains off searching for the best ways to revision control data. They all work and they all have their appropriate implementations based on use cases and so on. What I really want to know is why hasn't a database been written to natively support revisioning on the...
I've been tasked with revisiting a database schema we designed and use internally for various ticketing and reporting systems. Currently there exists about 40 tables in one Oracle database schema supporting perhaps six webapps.
However, there's one unifying relationship amongst them all: a rooms table describing the room. Room name, pu...
Intro
I am trying to decide how best to set up my database schema for a (Rails) model. I have a model related to money which indicates whether the value is an income (positive cash value) or an expense (negative cash value).
I would like separate column(s) to indicate whether it is an income or an expense, rather than relying on whethe...
Hello, guys!
I have a problem and I dont know what is better solution.
Okay, I have 2 tables: posts(id, title), posts_tags(post_id, tag_id).
I have next task: must select posts with tags ids for example 4, 10 and 11.
Not exactly, post could have any other tags at the same time.
So, how I could do it more optimized? Creating temporary tab...
I am going to use a contrived example: one headquarter has one-or-many contacts. A contact can only belong to one headquarter.
TableName = Headquarter
Column 0 = Id : Guid [PK]
Column 1 = Name : nvarchar(100)
Column 2 = IsAnotherAttribute: bool
TableName = ContactInformation
Column 0 = Id : Guid ...