database-design

Does limiting the size of rows benefit MySQL table size?

痴心易碎 提交于 2019-12-25 06:43:39
问题 I know that limiting the row size will keep the size at a set maximum, however, if i limit all my rows to the maximum that they will ever need, does that increase performance on the rows (i.e. take up less space) Or does mysql dynamically allocate the size necessary for rows and maximum row length has no affect on it? 回答1: MySQL will not dynamically size fields; the potential required size is determined by the data type you choose. However, you can choose appropriate data types to help

Django - how to normalize database?

╄→гoц情女王★ 提交于 2019-12-25 06:07:01
问题 I keep asking people how I should organize my model, and they keep telling me to normalize the database. Can someone show me an example of a normalized Django model? 回答1: Normalisation is not a Django or even Python concept - it is a wider approach to designing a relational database schema such that you remove duplication and eliminate redundancy. In django this means that rather than have one model, you might have multiple smaller models, which represent the relationship between database

creating a SQL table with multiple columns automatically

↘锁芯ラ 提交于 2019-12-25 05:48:09
问题 I must create an SQL table with 90+ fields, the majority of them are bit fields like N01, N02, N03 ... N89, N90 is there a fast way of creating multiple fileds or is it possible to have one single field to contain an array of values true/false? I need a solution that can also easily be queried. 回答1: At least you can generate ALTER TABLE scripts for bit fields, and then run those scripts. DECLARE @COUNTER INT = 1 WHILE @COUNTER < 10 BEGIN PRINT 'ALTER TABLE table_name ADD N' + RIGHT('00' +

Database engineering: Many Rows or extra backup columns for a scenario like Extendable Profile Table

ぃ、小莉子 提交于 2019-12-25 04:57:24
问题 I have a decision to make for a database with up to 20,000+ student profiles, Each student profile have more than 120+ Property, In many Enterprise projects like DOTNETNUKE CMS, the used method is two tables, one is UserProfile : [ProfileID],[UserID],[PropertyDefinitionID],[PropertyValue] and the other is : ProfilePropertyDefinition [PropertyDefinitionID],[DataType] ,[PropertyCategory],[PropertyName] If i used this method i will have 20,000 x 120 = 2.4 million row! I know this is the correct

SQL: Selecting from multiple tables in one query or a query for each table?

浪子不回头ぞ 提交于 2019-12-25 04:24:16
问题 A follow up question concerning the DAL layer part .. The first question about dealing with large objects I have one table (PlacesTable) that is connected by like 6 other tables (1:Many and Many:Many relations) In my DAL should I put a big query that join the 6 tables + the m:m reference tables (btw it produces multiple data that I don't need Please refer to my old question) and place all the data in it's specific object property or, should I use a single query for each table and create an

Need advice to change my database design

时光毁灭记忆、已成空白 提交于 2019-12-25 04:22:40
问题 I need to change the way I am storing information in the DB. Because the query works slow with the old model I had developed. General problem is following. 1) I have list of courses, and each course has list of tags describing general content of the course. For instance, the course called " Database Management Systems" could have following tags { sql, index, key, relation }. 2) I have professors who have tags also which generally describe what do they teach in their courses . For example,

DataBase design: one to many database?

主宰稳场 提交于 2019-12-25 04:17:32
问题 I am very new to database designing. I have a doubt. The question is very basic. But please help me out. i will try to expain it through an example. Suppose, I got books in one table and their authors in the other(assuming that one book is written by just one author(one to many) and one author can write many books(many to one)). I am not getting how exactly to link the tables and what should be auto-incremented? tblBooks //Table 1 contains two entities { bookId // This field is auto

Connecting Supertype / Subtype?

泪湿孤枕 提交于 2019-12-25 04:15:51
问题 I have to connect Supertype Entity Called Users ( User_ID (PK) , User_Password , Registration_Date , .. etc ) . to Each one of the following entities : Employees ( Employee_ID (PK) , Fname , Lname , Birthdate .. etc ) Customers ( Customers_ID (PK) , Fname , Lname , Birthdate .. etc ) Suppliers( Supplier_ID (PK) , Fname , Lname , Birthdate .. etc ) .. How To Do It ( For relational database ) Using Ms-Access ? 回答1: There are generally 3 strategies for representing inheritance in the relational

How to structure table Activities in a database?

青春壹個敷衍的年華 提交于 2019-12-25 04:06:08
问题 I have a site written in cakephp with a mysql database. Into my site I want to track the activities of every users, for example (like this site) if a user insert a product I want to put this activity into my database. I have 2 ways: 1) One table called Activities with: - id - user_id - title - text - type (the type of activity: comment, post edit) 2) more table differenced by activities - table activities_comment - table activities_post - table activities_badges The problem is when I go to

Any tools for Understanding Existing Foxpro Database Model?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 03:56:30
问题 I have some dbf files of foxpro database. However, I have no idea about what are relationship between tables regarding foreign key, what tables are inter related and so on. Is there any tool which can help me to learn relationships easily. I mean which can draw relationship instead of me figuring out by hit and try.? I want to export this database to Microsoft SQL Server. So I want to learn whole database schema to learn tables logic. Thanks 回答1: Is this just a set of VFP free tables or is