database-design

How should I setup my mySQL tables for this simple php points system?

本小妞迷上赌 提交于 2020-01-05 08:08:33
问题 Hello I am trying to figure out the best way to setup my two mysql tables for a simple points system? What I have: 1 - users table with id (unique),name,email,etc 1 - points table with id (auto incrementing),user_id (corresponds with id field in user table), points Currently I am just writing to the points table and letting the id field auto increment... and setting the user_id field and points fields with php in the query. Is this the "proper" way to set this up? Where the id from the user

Designing Simple Schema for Disaggregation of Demand Forecast

蓝咒 提交于 2020-01-05 07:38:55
问题 Edit : [ Details ] I am doing a simple database design task as a training exercise where I have to come up with a basic schema design for the following case: I have a parent-child hierarchy of products (Raw Material > Work in Progress > End Product). Orders are placed at each level. Number of orders shall be viewable in weekly buckets for the next 6 months. Demand forecast can be made for each product level. Demand forecast is done for weekly buckets, for the next 6 months. It's usually done

Should I divide a table by OneToOneField if the number of columns is too many?

风格不统一 提交于 2020-01-05 07:22:08
问题 I have a student model that already has too many fields including the name, nationality, address, language, travel history, etc of the student. It is as below: class Student(Model): user = OneToOneField(CustomUser, on_delete=CASCADE) # Too many other fields A student has much more information I store in other tables with a OneToOne relationship with the student model such as: class StudentIelts(Model): student = OneToOneField(Student, on_delete=CASCADE) has_ielts = BooleanField(default=False,

Many-to-one relationship in SQLAlchemy

二次信任 提交于 2020-01-05 07:16:53
问题 This is a beginner-level question. I have a catalog of mtypes: mtype_id name 1 'mtype1' 2 'mtype2' [etc] and a catalog of Objects, which must have an associated mtype: obj_id mtype_id name 1 1 'obj1' 2 1 'obj2' 3 2 'obj3' [etc] I am trying to do this in SQLAlchemy by creating the following schemas: mtypes_table = Table('mtypes', metadata, Column('mtype_id', Integer, primary_key=True), Column('name', String(50), nullable=False, unique=True), ) objs_table = Table('objects', metadata, Column(

is this sort of SQL structuring (in a mysql database) efficient in a real world model?

℡╲_俬逩灬. 提交于 2020-01-05 07:05:01
问题 i was hoping to get feedback on an example mysql structure for a web application in a real world environment from people who have used complex mysql in real world situations before. example ~ education management app. 80,000 users. each user gets his own database containing tables for -messages -uploads -grades -info and more tables for other features what I'm wondering is, and any info would be appreciated, in a situation like this -is this databasing model efficient? (basically like 80,000

is this sort of SQL structuring (in a mysql database) efficient in a real world model?

元气小坏坏 提交于 2020-01-05 07:04:13
问题 i was hoping to get feedback on an example mysql structure for a web application in a real world environment from people who have used complex mysql in real world situations before. example ~ education management app. 80,000 users. each user gets his own database containing tables for -messages -uploads -grades -info and more tables for other features what I'm wondering is, and any info would be appreciated, in a situation like this -is this databasing model efficient? (basically like 80,000

Database design help with varying schemas

亡梦爱人 提交于 2020-01-05 04:26:10
问题 I work for a billing service that uses some complicated mainframe-based billing software for it's core services. We have all kinds of codes we set up that are used for tracking things: payment codes, provider codes, write-off codes, etc... Each type of code has a completely different set of data items that control what the code does and how it behaves. I am tasked with building a new system for tracking changes made to these codes. We want to know who requested what code, who/when it was

PostgreSql - unique rows, independent of order

隐身守侯 提交于 2020-01-05 04:25:11
问题 I'm having a bit of difficulties with the current problem a member has a match with another member - it can only appear once. say we have a scheme with a table called Member and another table called Match Member ------------- | id | name | ------------- | 1 | bob | | 2 | tim | Match ------------------------ | memberid | requestid |(memberid is a foreign key to member same as requestid) ------------------------- | 1 | 2 | however now a request comes in from memberid 2 and it should reject it,

Django model for variable type of data

♀尐吖头ヾ 提交于 2020-01-05 04:10:27
问题 What I am trying to do is a database to keep track of personal records. The model is almost done, but I'm facing some dificult to store diferent types of records. There are records for time, for weight, for repetitions/laps, distance... So, there are diferent types of data: time, decimal, integer... At first I created a table (or class in django) for each type of data. A table to time, other to weight (decimal) and so on. But I am wonder if there is a better solution to keep only one table

Sharing users between 2 databases

耗尽温柔 提交于 2020-01-05 03:38:41
问题 I am developing this application in PHP. The application will consist of an adminstration area which will also contain employee functions. The other part of the application is the customer facing website. The administration area has its own database. The customer facing website also has its own database. In the administration database, I have a table with users and I also plan to implement RBAC so that users can have roles, permissions and so on. The customer facing website also allows