database-design

How to design DB table / schema with ease?

£可爱£侵袭症+ 提交于 2020-01-13 07:12:11
问题 Is there a simple method to decide on what fields and indexes are needed for each table in an app you design? For example, if it is a webapp that simply lets people create lists (any number of lists, and users can create "things to do" list or "shopping" list), and the user can assign other users to edit the list, and whether the list is viewable publicly or to only certain users, how can the tables be design so that it is very accurate and designed quickly? What about the indexes? I did that

Design of an 'EAV' or 'Class/Concrete Table Inheritance' database for stock control

匆匆过客 提交于 2020-01-13 05:09:13
问题 I am developing a stock control system for a construction project. The storeman is responsible for adding new stock and distributing/returning it to/from employees. The items (and hence their attributes) will be very varied; e.g. steelwork, clothing, plant/machinery, tools, etc. My question is whether to go for a Class/Concrete Table Inheritance or EAV based schema. I don't know what attributes items will have, so presumably a Class/Concrete Table Inheritance approach would require the end

Struggling with a MySQL database of phone numbers

放肆的年华 提交于 2020-01-12 20:26:05
问题 My application wants to store a list of international phone number in a mysql database. Then the application would need to query the database and search for a specific number. Sounds simple but it's actually a huge problem. Because users can search for that number in a different format we'll have to do a full scan to the database each time. For example. We might have the number 17162225555 stored in the database (along with another 5 million entries). Now the user comes along and attempt to

Should I use EAV database design model or a lot of tables

末鹿安然 提交于 2020-01-12 10:14:11
问题 I started a new application and now I am looking at two paths and don't know which is good way to continue. I am building something like eCommerce site. I have a categories and subcategories . The problem is that there are different type of products on site and each has different properties . And site must be filterable by those product properties. This is my initial database design: Products{ProductId, Name, ProductCategoryId} ProductCategories{ProductCategoryId, Name, ParentId}

Should I use EAV database design model or a lot of tables

梦想与她 提交于 2020-01-12 10:08:26
问题 I started a new application and now I am looking at two paths and don't know which is good way to continue. I am building something like eCommerce site. I have a categories and subcategories . The problem is that there are different type of products on site and each has different properties . And site must be filterable by those product properties. This is my initial database design: Products{ProductId, Name, ProductCategoryId} ProductCategories{ProductCategoryId, Name, ParentId}

What is the best way to store the order between rows in the database? [closed]

霸气de小男生 提交于 2020-01-12 09:45:06
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 12 months ago . I am cloning and extending the Google Tasks application. I want to be able to store the rows order. I have created a field in the database, named rowNumber. When the user inserts a row in the middle of others, I have to update this field in many other rows to achieve the

DB design help - EAV + Form builder

社会主义新天地 提交于 2020-01-12 08:50:30
问题 I'm trying to build a sort of form builder that'll allow me to define, display and store 'tests' in a flexible way. I.e. Allow the user, through the web interface, to create a new type of test/form ("Grouping") and define a set of fields that will be displayed on the form (any type of field, including date, text, radio, checkbox, etc). I'll also need a results table that'll store the values saved in each form/test. As an inadequate example, I have the following 3 tables so far: dd

DB design help - EAV + Form builder

不羁岁月 提交于 2020-01-12 08:49:30
问题 I'm trying to build a sort of form builder that'll allow me to define, display and store 'tests' in a flexible way. I.e. Allow the user, through the web interface, to create a new type of test/form ("Grouping") and define a set of fields that will be displayed on the form (any type of field, including date, text, radio, checkbox, etc). I'll also need a results table that'll store the values saved in each form/test. As an inadequate example, I have the following 3 tables so far: dd

Any reason to still use snake case for database tables and columns?

爷,独闯天下 提交于 2020-01-12 07:57:05
问题 Back when I started with database design, for some reason it was recommended that you always use snake case (my_table_name) for tables and columns. I think this was especially true in MySQL. The reasoning was there were instances where capitalization would be lost or enforced. Flash forward to today and I see a lot of people using Pascal Case ("MyTableName"), which I would prefer. Is there any reason to still use snake case for table and column names? Are there any instances where

The values of one column cannot be greater than another

喜夏-厌秋 提交于 2020-01-12 07:45:12
问题 I am trying to create a table where the values in one column can't be greater than the next column over. For example, I am creating the following table. CREATE TABLE Price ( PriceID INT PRIMARY KEY IDENTITY (1,1), OriginalPrice FLOAT NOT NULL, CurrentPrice FLOAT NOT NULL, Discount FLOAT, ShippingCost FLOAT NOT NULL, Tax FLOAT NOT NULL); And Current Price cannot be greater than OriginalPrice. So what I tried doing was CurrentPrice FLOAT CHECK (CurrentPrice <= OriginalPrice) NOT NULL, But this