data-modeling

ExtJS 4: Models with Associations and Stores

筅森魡賤 提交于 2019-11-27 18:09:09
Introduction I'm facing an application design problem with the Ext.data.Model class in ExtJS. I will try to develop my ideas to a very common online store scenario here, so you can follow me. I would really appreciate any comments on my thoughts and conclusions! Models Let's suppose you want to map the fact that " Every customer can order multiple products " to ExtJS. From the bare words one can identify these three models involved: Customer , Order , and Product . The Order in this case is what connects Customer s and Product s. Associations I found that ExtJS actually allows you to specify

How to put a complicated equation into a R formula?

落爺英雄遲暮 提交于 2019-11-27 18:01:36
问题 We have the diameter of trees as the predictor and tree height as the dependent variable. A number of different equations exist for this kind of data and we try to model some of them and compare the results. However, we we can't figure out how to correctly put one equation into the corresponding R formula format. The trees data set in R can be used as an example. data(trees) df <- trees df$h <- df$Height * 0.3048 #transform to metric system df$dbh <- (trees$Girth * 0.3048) / pi #transform

What should I name a table that maps two tables together? [closed]

穿精又带淫゛_ 提交于 2019-11-27 17:00:46
Let's say I have two tables: Table: Color Columns: Id, ColorName, ColorCode Table: Shape Columns: Id, ShapeName, VertexList What should I call the table that maps color to shape? Table: ??? Columns: ColorId, ShapeId tosh There are only two hard things in Computer Science: cache invalidation and naming things -- Phil Karlton Coming up with a good name for a table that represents a many-to-many relationship makes the relationship easier to read and understand. Sometimes finding a great name is not trivial but usually it is worth to spend some time thinking about. An example: Reader and Newspaper

What is the best way to represent “Recurring Events” in database?

与世无争的帅哥 提交于 2019-11-27 16:41:08
I am trying to develop a scheduler- and calendar-dependent event application in C#, for which a crucial requirement is to represent recurring events in the database. What is the best way to represent recurring events in a database? More Details: While creating the event I am also sending invites to the certain users and the invitees should be allowed to login to the meeting only during the specified window(meeting duration) or may be decline the login when the invitee attempts to login say, 5 minutes before the scheduled start of the meeting. The sysjobs , sysjobsschedule and sysschedules

SQL - Best practice for a Friendship table

走远了吗. 提交于 2019-11-27 13:14:23
问题 Before you show me duplicates, please note that I've searched through the site an have found some examples but not quite specific to my problem :) What's the best way to create a Friendship table in SQL, but making sure that each row is unique in the sense that the same UserID and FriendID will never be alowed regardless of which column they belong to? I have this rough example CREATE TABLE [dbo].[Friendship]( [UserID] [uniqueidentifier] NOT NULL, [FriendID] [uniqueidentifier] NOT NULL,

MySQL friends table

。_饼干妹妹 提交于 2019-11-27 11:42:39
问题 I have a MySQL DB in which I store data about each user. I would like to add a list of friends for each user. Should I create a table of friends for each user in the DB or is there a better way? 回答1: Assuming all your friends are also in the user table you will need a friends table which defines a simple one-to-many relationship - linking the users table back to itself. So User Table UserID int identity not null [other attribute fields] Friends Table UserIDLink1 int UserIDLink2 int [other

What's the longest possible worldwide phone number I should consider in SQL varchar(length) for phone

谁说胖子不能爱 提交于 2019-11-27 10:12:06
What's the longest possible worldwide phone number I should consider in SQL varchar(length) for phone. considerations: + for country code () for area code x + 6 numbers for Extension extension (so make it 8 {space}) spaces between groups (i.e. in American phones +x xxx xxx xxxx = 3 spaces) here is where I need your help, I want it to be worldwide Consider that in my particular case now, I don't need cards etc. number begins with country code and ends with the extension, no Fax/Phone etc. comments, nor calling card stuff needed. Well considering there's no overhead difference between a varchar

Should OLAP databases be denormalized for read performance?

你。 提交于 2019-11-27 09:57:58
I always thought that databases should be denormalized for read performance, as it is done for OLAP database design, and not exaggerated much further 3NF for OLTP design. PerformanceDBA in various posts, for ex., in Performance of different aproaches to time-based data defends the paradigm that database should be always well-designed by normalization to 5NF and 6NF (Normal Form). Have I understood it correctly (and what had I understood correctly)? What's wrong with the traditional denormalization approach/paradigm design of OLAP databases (below 3NF) and the advice that 3NF is enough for most

How can I avoid NULLs in my database, while also representing missing data?

纵饮孤独 提交于 2019-11-27 09:19:49
问题 In SQL and Relational Theory (C.J. Date, 2009) chapter 4 advocates avoiding duplicate rows, and also to avoid NULL attributes in the data we store. While I have no troubles avoiding duplicate rows, I am struggling to see how I can model data without making use of NULL . Take the following, for example - which is a bit from work. We have an artist table, which has, amongst other columns, a gender column. This is a foreign key to the gender table. However, for some artists, we don't know their

Storing multiple choice values in database

倖福魔咒の 提交于 2019-11-27 06:26:02
问题 Say I offer user to check off languages she speaks and store it in a db. Important side note, I will not search db for any of those values, as I will have some separate search engine for search. Now, the obvious way of storing these values is to create a table like UserLanguages ( UserID nvarchar(50), LookupLanguageID int ) but the site will be high load and we are trying to eliminate any overhead where possible, so in order to avoid joins with main member table when showing results on UI, I