database-design

Storing a distance matrix in DB [closed]

♀尐吖头ヾ 提交于 2019-12-23 19:15:55
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I need do display a distance matrix on my web-page for all the nearby locations for a city. I would like to fetch all this data from

Database Design: Register and Verification

故事扮演 提交于 2019-12-23 19:08:49
问题 Is it a good choice to have unverified users into the users_table or should I make a temp_users_table to add the unverified users? The first option would be to create the row on the users_table with a column, for instance, account_activated to hold a integer that defines if the account is verified or not. The Second option would be to have two identical tables, users_table and temp_users_table . Adding the unverified users on the last. When verified the row will be copied to the users_table

Generating reports from MySQL tables

自作多情 提交于 2019-12-23 18:50:30
问题 Let's say you have a bunch of MySQL tables, and you want your end users to be able to generate reports with that data with a PHP script. You can present the field names from those tables in a dropdown, so a user might be able to say, " first_name equals John." Great. But what if you want those field names to be a little more readable? For instance, I'd like the user to be able select "Name of First Pet" as a field, instead of " first_pet_name ." I definitely don't want to store that

Do multiple foreign keys make sense?

梦想的初衷 提交于 2019-12-23 18:33:16
问题 can it make sense for one table to have multiple foreign keys? Suppose I have three tables, Table A , Table B and Table C . If I think of the tables as objects (and they are mapped to objects in my code), then both Tables A and B have a many to one relationship with Table C. I.e. Table/object A and B can each have many instances of C. So the way I designed it is that Table C points to the primary key in both Table A and Table B : in other words, Table C has 2 foreign keys (a_Id, and b_Id).

Is it practical to dynamically normalize a table?

只愿长相守 提交于 2019-12-23 18:19:32
问题 Let's say my database tracks bird sightings (Note: I'm really scraping the bottom of the barrel for examples). The fields are: sighting_id | common_name | park_name | location | time | etc.... Although I'm assuming that a park will always be in the same location, the website is like a spreadsheet. The user enters park_name and location for every entry. Also please note that my actual schema has other fields that are dependent on the analogous "park name" as well (e.g. state). I do not have a

database design in google app engine

て烟熏妆下的殇ゞ 提交于 2019-12-23 18:06:05
问题 i am designing a simple project based to do list. the idea is to define tasks under project ( no workflow - just "task is completed" or not is required. ) in a hirarchial way. i.e. each task has multiple task and that task may have other multiple task. a project can be said to be completed if all task under that project are completed. , i tought of using refrenceproeperty to create hirarchy , but could not figure out easy way ( which do not take more than 30 seconds to find all the children

How to store arrays in a database?

℡╲_俬逩灬. 提交于 2019-12-23 17:14:31
问题 I have a simple messaging system that up till now uses file based storage. Because the number of users of the system is increasing gradually I would like to switch over to database based storage. In code the message server maintains a list of users (with their credentials) and a list of messages. A Message object has as its main fields a Sender (of type User), Recipients (of type User[]) and a Content(of type string). Typically, a user will request the messages addressed to him from the

How to normalize a database schema

别来无恙 提交于 2019-12-23 17:13:33
问题 I have two tables: customer ( client_id(PK), lastname, firstname, flightID (Fk) ) flight ( flight_id(PK), flightarrival, flightdepart ) My questions are: Are there any problems with the schema? How can I add data to the flight table? I really want to separate the two because bulk tables are confusing. Here is an example of a "bulk table": customer( client_id(PK), lastname, firstname, flightarrival, flightdepart ) but I want to normalize it and separate it from the customer table and just link

Database best practices - Status

你。 提交于 2019-12-23 17:04:01
问题 I'm creating an application in which objects have a status lookup. To give some context, let's use the following example. A helpdesk application where jobs are created and move through the following workflow: New - Job created but unassigned In Progress - Job assigned to a worker and in progress Complete - Job complete ready for invoicing Closed - Job invoiced So, I create a status table with the following details: int ID string Name and a lookup column on the jobs table int ID string Name

Relationship between the compositions of two entities which have N2N relationship between themselves

☆樱花仙子☆ 提交于 2019-12-23 16:31:06
问题 I have two entities defined: Product: ProductId (PK) Name (not null) Parts: PartId (PK) Name (not null) These have a many-to-many relationship defined between them. In my requirements I need to model another one-to-many relationship between the composite product/part item to some other composite product/part. In certain instances I also need to be able to link product without a part to product/part item. I have modeled it this way: ProductPartLink: ProductPartLinkId (PK) ProductId (not null)