database-design

Database Modeling: Product with 1 or more categories

末鹿安然 提交于 2020-01-04 13:36:55
问题 I'm working on a database design that allows for a product to be in 1 or more categories. A category can be in a parent-child relationship. Here's what I have so far: ================== product ================== product_id name ================== category ================== category_id parent_category_id level name ================== product_category ================== product_id category_id (leaf node only) Questions Does the design look good? Am I right to only be concerned with the leaf

Modeling data on a many-to-many join in Mongo?

会有一股神秘感。 提交于 2020-01-04 13:23:54
问题 So in a relational DB I might have 2 tables, 'User' and 'Event', which have a many-to-many relationship, and thus a join table 'UsersEvents' say. Now I have some data that I want to store on this table other than the 2 IDs, something like a boolean called 'Enjoyed'. I understand that in Mongo you would create embedded links between the tables e.g. using Mongoose var Person = new Schema({ email: String, events: [EventFeedback] }) var Event = new Schema({ ... }); var EventFeedback = new Schema(

Role-dependent associations

左心房为你撑大大i 提交于 2020-01-04 09:07:32
问题 I am working on my first real Rails app for timetracking in a company and I have run into database/model design concern. My app has a User model and a Role model which are linked together through a has_and_belongs_to_many association. One of the roles is the manager. A manager can have many assistants and assistants can have many managers (although typically only one). This relationship is represented through a manager_assistant_relationship expressed in the User model as: has_many

DB Design to allow user to define products, product specs and let themself insert orders

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-04 04:38:46
问题 I'm designing a db because I need to develop such a CRM, where the users are able to specify new products, products specs and pricing and then let themself to insert orders for that products specified in a previous step. Of course the data inserted needs to be evaluated according to what they specified in the db. I may be more clear with an example: user1 creates a product "apple", specifies then "color" and "weight" as attribute specs for that product. Then user1 says that the apple pricing

What are the pros and cons of one master base table which all entities inherit from?

落爺英雄遲暮 提交于 2020-01-04 02:56:10
问题 I am using Entity Framework Database first approach to create my domain model. I am considering creating a base table EntityBase with the base properties in: PK CreatedDate CreatedBy ModifiedDate ModifiedBy etc. Using Table Per Type inheritance I will end up with a single table in the Database linked to all other entity tables: EntityBase { EntityBase_PK => Identity PK CreatedDate CreatedBy ModifiedDate ModifiedBy } DerivedEntity1 { DerivedEntity1_PK => FK relationship to EntityBase on

How to represent complex and hybrid data

╄→гoц情女王★ 提交于 2020-01-04 02:14:50
问题 I have a quite complicated question. I'm looking for a javascript or PHP script that can take about any data (arrays, mysql queries ...) and make a table / pivot table / chart of it. to be simple, I want an app that is able to take any data and represent it as we ask. For example take content rated by a user. I want to be able to make a graph of the number of person that rated 1,2,3,4 or 5. I want to make a table with the number of users that rated in july and in august. I want to get the

Azure, MVC web app architecture - how to split data between SQL Azure and Azure Table Storage?

心不动则不痛 提交于 2020-01-04 02:11:13
问题 I am in the planning phase of the typical social network type of a web application. It will have profiles, messages, instant chat, albums, groups, virtual presents, etc... What are the deciding factors that determine what data should be stored in the SQL Azure and what data should be stored in the Table Storage? Before the Azure all relational data would be stored in the SQL server and then memory caching with data objects and pages output caching would be used for performance and to ease the

Designing lossless-join, dependency preserving, 3NF database

青春壹個敷衍的年華 提交于 2020-01-03 19:42:50
问题 I need to design database which would keep track of the following attributes: stdnum // student number postcode // postal code phone_number // student phone number city // student address: city Also listed are functional dependencies: stdnum -> postcode stdnum -> phone_number postcode -> city phone_number -> city I need to find lossless-join, dependency preserving, 3rd normal form decomposition of the attributes . I have tried different decompositions but there was no one that obeys all

Designing lossless-join, dependency preserving, 3NF database

我只是一个虾纸丫 提交于 2020-01-03 19:41:12
问题 I need to design database which would keep track of the following attributes: stdnum // student number postcode // postal code phone_number // student phone number city // student address: city Also listed are functional dependencies: stdnum -> postcode stdnum -> phone_number postcode -> city phone_number -> city I need to find lossless-join, dependency preserving, 3rd normal form decomposition of the attributes . I have tried different decompositions but there was no one that obeys all

Use BLOB or VARBINARY for Encrypted Data in MySQL?

妖精的绣舞 提交于 2020-01-03 16:49:36
问题 I'm working on a PHP application that accepts user input via a text area. It will be stored encrypted in the database (using AES_ENCRYPT). Should I use a BLOB or VARBINARY field? Are there performance implications for either type of field? 回答1: Both BLOB and VARBINARY are "string" data types, that store binary strings (effectively byte arrays), as opposed to the usual string types, which store character strings, with charset encoding etc. In most respects, you can regard a BLOB column as a