database-modeling

Database Design: Why do some ecommerce database have separate tables for products and product_variants?

Hi Why do some ecommerce database have tables: product product_variant Why not only one product table with all teh fields of product_variant and is_default_product(bool) field? Thanks ...

(Database Design - products attributes): What is better option for product attribute database design?

Hi, I new in database design. What is better option for product attribute database design for cms?(Please suggest other options also). option 1: 1 table products{ id product_name color price attribute_name1 attribute_value1 attribute_name2 attribute_value2 attribute_name3 attribute_value3 } option 2: 3 tables products{ id product_na...

Single Table Inheritance (Database Inheritance design options) pros and cons and in which case it used?

Hi, I study about today about 2 database design inheritance approaches: 1. Single Table Inheritance 2. Class Table Inheritance In my student opinion Single Table Inheritance make database more smaller vs other approaches because she use only 1 table. But i read that the more favorite approach is Class Table Inheritance according Bill...

Database Memory :: MySql Innodb how much storage memory allocation for empty field vs not empty field - varchar or text

Hi, I new in database, and dont know how and when mysql allocate memory space. In MySql Innodb how much storage memory allocation for empty field (no string inserted) vs not empty field? Other form of my question: When memory allocated space In MySql Innodb for varchar/text field in time of table creation or when data inserted ins...

Database model for storing expressions and their occurrence in text

Hey, I'm doing a statistical research application. I need to store words according to 2 initial letters which is 676 combinations and each word has its number of occurrences (minimal, maximal, average) in text. I'm not sure how the model/schema should look like. There will be a lot of checking whether the keyword was already persisted. ...

Database MySql design - varchar length for utf8 fields :: 1. password 2. username 3.email

Hi, Most of the times I define varchar(255) length auto. But now I thinking how much varchar length should be best to define for utf8 fields: password username email If this fields should be define less than varchar 255, how much performance it will improve? Thanks ...

Modeling a database (ERD) that has quirky behavior

One of the databases that I'm working on has some quirky behavior that I want to account for in the entity-relationship diagram. One of the behaviors is that there is a 'booking' table and a 'invoice' table. When a 'booking' is invoiced, then the record is inserted into the 'invoice' table and then deleted from the 'booking' table. Ho...

Modeling database : many small tables or not ?

Hello, I have a database with some information which are repeated in some tables. I want to know if it's interesting to create a table with this information and in the other table, I put only the id. It's interesting because with this method I haven't got redundance. But I will have to do many joints between my tables in my request, ...

general database modeling and django specific modeling

I'm wondering what is the best way to model something like the following. Lets say my company sells metal bars (parameters/fields are: length, profile_type, quantity etc.) of different profiles, where profiles may be pipe(pipe_diameter, wall_thickness) or hollow_rectangle(base, height, wall_thickness), or maybe some other profile with d...

Yii framework "meta db model" creation + postgres inheritance

I have few DB tables, witch are build using inheritance from one table witch is an sort of "template" for creation of new tables, and now i have set of businesses logic methods witch work on columns inherit from template, additional columns are used only as params for presentation of models, they're have no meaning for logic. The goal i...

Class Table Inheritance with a hierarchy

I have 3 data types with -- a) Common columns b) a hierarchy -- and would like to know how to design the database. Let's say at the top level, there is a Discussion. Within that, there are DiscussionMessages, Files and Comments. They all have fields in common (UserID, CreateDate, Text), but also have unique columns (FileName, ContentT...

Database modeller for JPA with visual diagrams

I am looking for a tool to help in designing and implementing database and entities for a Java project. Probably we are using JPA or direct Hibernate. The features I look for are: Design database with visual modeller Create entities from the visual model Update entity changes to the visual model Import existing database schema as visua...

How to Model/Document Existing Stored Procedure Flow

Hi, I started working with a GPS Tracking System, whose backend logic is almost entirely based on the execution of Stored Procedures. They were implemented on a SQL 2000 database. I received the task to document/model the existing stored procedure flow, but I don't have experience with such a task. I was used to UML, but since its focu...

Database design for dynamic form field validation

In my application, I allow users to create a form containing any HTML form field they want (e.g. text input, textarea, select, etc.). I want to give the users the ability to define 0 or more cumulative validation rules for each field (there might be up to 25 different validation rules). How should I model this? Here's a potential soluti...

What are some useful online database modeling applications?

I realize there have been prior questions regarding database modeling programs, but in particular I'm looking for online ones. Can anyone recommend any? And FYI, I will be using PostgreSQL but any generic one should suffice. ...

UML Modelling: How to set the combination of two colums to be unique?

Hello everybody, I have a question about DB modeling, I have a table created as following: CREATE TABLE "users_articles" ("id" INTEGER PRIMARY KEY NOT NULL,"article_id" INTEGER,"user_id" INTEGER) Which statement will alter this table, so that the combination of article_id and user_id is unique? Which statement tells me, if the DB h...