database-design

Best way to fetch data from localized database

会有一股神秘感。 提交于 2019-12-23 05:19:50
问题 I created table structure to make statuses localized in database: Status {StatusId, Value} -- Value in this table is status value in default language StatusTranslation {StatusId, Language, TrasnlationValue} -- StatusId and Language are combined key But I am having trouble to make this work in entity framework. When default languege it is easy Status.ToList() but when I need translation I pass to the get method de-CH but I can't return translated Status. What is the best way to map this using

DB Design Question about Nullable Foreign Keys and Normalization

最后都变了- 提交于 2019-12-23 05:12:27
问题 I'm hoping to get a consensus about what db schema is best for my situation to store 'type' information for Widgets in a table. A Widget can have only one type but that type can be either a Preset-Type OR a Custom-Type. I obviously create the preset types and a user would create a custom type. I'll be using MySQL and INNODB on a server. I'll also be using SQLite to store the same info on an App. But we'll just talk about the server here. I'm an app programmer, not a DB admin, but want to get

How to establish a many to one relationship between 2 tables for a field

断了今生、忘了曾经 提交于 2019-12-23 05:06:52
问题 I am building an database schema for a project and I am bit stuck on this issue. I have 2 tables: USER table: Id Name Contact_ID 1 Arun 2 2 Barath 3 3 Charan 2 4 Dinesh 1 CONTACT table: ID Name Phone Mail 1 Mahesh 1234 Mahesh@Yahoo.com 2 Suresh 54321 Sureh@Google.com 3 Jayesh 9876 Jayesh@Bing.com 4 Ganesh 98754 Gahesh@Safari.com Each of the users in USER will have a contact in CONTACT. If a user has a single contact then I can use a foreign key relationship on Contact_ID in USER and build the

Yii framework “meta db model” creation + postgres inheritance

我的梦境 提交于 2019-12-23 04:52:50
问题 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 is to share businesses logic methods along all of that tables, i know, now it can be done by adding another class witch extends CActiveRecord, and extend from

RethinkDB Survey Modelling

℡╲_俬逩灬. 提交于 2019-12-23 04:45:07
问题 I'm starting a new project (a survey application) and I chose RethinkDB as my database; however, I have some questions about data modelling. I'm going to have questions that can be answered only once by each user. Moreover I'll have reports that will tell the percentage of users that chose each option. At first I thought of the following modelling: { title: String, total_answers: Number, options: [{ value: Number, label: String, respondents: [User IDs] }] } The problem is that RethinkDB

Database Designing for Vote Buttons

只谈情不闲聊 提交于 2019-12-23 04:44:00
问题 I am working on a Project in which i have Voting Options Up and Down similar to StackOverFlow. I am not much experienced in DB Designing and thus i got up with the following issue, First of all, here is my table structure for voting : voteId -----AUTO_INCREMENT with PRIMARY KEY. mediaId ----The Media for which user gives an up/down vote. userId -----The User who Voted. voteMode ---1 for Up Vote and 0 for Down Vote. This is an Integer Field. In this case if i have 100 users and 100 medias,

What is the most efficient way to specify user permissions in a database?

左心房为你撑大大i 提交于 2019-12-23 04:39:08
问题 I have an application that associates users with specific groups in a Facebook-style manner. For example: User A is associated with Group 1 and Group 2 User B is associated with Group 2 and Group 4 Users can create posts (small amounts of text) for each group that they belong to. I have two types of pages: the home page for the logged-in user, and a page for each group. The user's home page shows posts from every other user that is in every group that the logged-in user belongs to . The group

Can't decide whether normalization or de-normalization would work

杀马特。学长 韩版系。学妹 提交于 2019-12-23 04:37:35
问题 this question may be a bit broad! Recently I am learning MySQL. I am making a school exam information database. I have created a table called subjects where information regarding various subjects are stored including full name or full marks for each subject. I have also created another table called exams where marks obtained by each student on each subject is stored. Obviously subjects is the master table and exams is the child table here. Based on the data stored in these 2 tables, when

Entity Framework on different database

浪子不回头ぞ 提交于 2019-12-23 04:31:10
问题 I have a project which uses entity framework. We map a mssql db with entity framework. Now we want to change mssql db to oracle db. But I don't want to change my model of db in entity framework. Two dbs are same tables columns etc. only difference is their technologies(mssql and oracle) and some of the column data types.In mssql we use bigint instead of number in oracle. Is it possible to use same model with difference dbs which have same tables on Entity framework? 回答1: The provider model

How to effectively design dynamic hierarchies in a data schema model?

自闭症网瘾萝莉.ら 提交于 2019-12-23 04:29:19
问题 To clarify, Let us say I have users and userstats in my database and I also have information like city, state, county, and region associated with these two tables. In this scenario I can effectively roll up my userstats to city, state, county and region levels easily by a overnight or incremental process. The alternate scenario where I don't have fixed groups like city, state, county but I want certain super users to have the flexibility to create their own groups and tie the users manually