database-design

Designing simple database relation (school)

∥☆過路亽.° 提交于 2019-12-25 03:39:31
问题 I'm new to designing database relations. Could someone have a look at my relations and see if it makes sense? This is what I've done, Relations Membership [ one to many ] Club Membership [ one to many ] Student Membership [ one to many ] Positions Category [ one to many ] Club Category [ one to many ] Position Description 1) Every student may be in multiple clubs. 2) They hold a position in each of these clubs (e.g. President, Chairman). 3) The positions belong to a particular category (e.g.

hierarchy property in graph database

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 03:14:01
问题 I'm starting to use neo4j. In my graph database I've the nodes Person (look at "John" below), with the labels: Name (string), Food (positive integer). Each Person is connected with other Person through the relationship isFriendTo , that has a value. I use the graph DB only to find the shortest weighted path between two person. Also, every day I check every node in the graph, and if the food go under value of 100, I take some actions. Now, after some improvements, the property Food is no more

Getting a database to 1NF or 2NF - mysql

蓝咒 提交于 2019-12-25 03:12:21
问题 How do I get this mysql database in better 1NF or 2NF form? I tried my best to remove redundant data. It appears there is redundant data still in "Prof_Dept" 回答1: The schema looks strange. How can a Department by a child of Professor_Dept (with the Professor_DeptID FK in it)? That means there is no "Science faculty". You would be storing professor john's science department professor john's physics department professor tom's physics department etc I think the tables should be Professor

Does a many-to-many relationship with a recursive one-to-many in mysql require at least 4 tables?

…衆ロ難τιáo~ 提交于 2019-12-25 03:08:55
问题 I have the following relationships (Business rules): User_Company : Many-to-many (multiple companies per user, multiple users per company) Ownership : One-to-One (For each entry in relationship table, it specifies whether user is an owner or employee. If owner then a percentage must be there) Company_ownership : One-to-many for company (Recursive relationship), as another company can also be an owner in a company, percentage must be given. So ownership or a company can be made up of a number

How to design this Database part?

守給你的承諾、 提交于 2019-12-25 03:06:14
问题 I'm using PHP and MySQL. I have a users table and a groups table. My question is, how can I implement a system in groups so that I can acces all the users id's which are part of that group. Example: I have John, Mary and Alex in the users table. John is id 1, Mary is 2 and Alex is 3. Now how can I add these users to the group users? I can't just add fields like "user_1", "user_2", "user_3". What if the group has 1000 members? 回答1: You can have a groups table and users table. add groupid as

suggestion for creating mysql database structure

ε祈祈猫儿з 提交于 2019-12-25 02:43:33
问题 I'm currently working on building custom application. My first module already completed and now I'm still figuring out how to create the structure for second and third module to work flawlessly without any error or worst crash the whole database. Some of the info:- My first module, data are manually exported as the database is the main structure for my second and third module to work with. My second module data are logs for report, where the data automatically enter to the database upon

Sybase Powerdesigner - how to automatically format naming of PK and FK?

旧街凉风 提交于 2019-12-25 02:28:23
问题 Sybase Powerdesigner - how to automatically format naming of PK and FK? Run script to format primary key and foreign key like this format PK_TABLENAME FK_PARENT_CHILD Example PK_Post FK_Post_Comment 回答1: The following solution is complicated, but also very flexible/ not so intrusive. This will get you started: In your PD model, create a new "Custom check with Autofix Option" for the Table Or Column (Or Reference) metaclass object. (Doesn't matter which you cheoose. You can iterate thru sub

Need MySQL optimization for complex search on EAV structured data

℡╲_俬逩灬. 提交于 2019-12-25 02:27:00
问题 I have a large database with EAV structured data that has to be searchable and pageable. I tried every trick in my book to get it fast enough, but under certain circumstances, it still fails to complete in a reasonable time. This is my table structure (relevant parts only, ask away if you need more): CREATE TABLE IF NOT EXISTS `object` ( `object_id` bigint(20) NOT NULL AUTO_INCREMENT, `oid` varchar(32) CHARACTER SET utf8 NOT NULL, `status` varchar(100) CHARACTER SET utf8 DEFAULT NULL,

Create a database table where entries can come from another table or entirely new input

给你一囗甜甜゛ 提交于 2019-12-25 02:18:40
问题 I have a table of customers, employees, and suppliers. Each of them has some common fields like name, address, contact_no, and email along with other fields. Now, I want a new table called investors. However, investors can be from employees, suppliers, customers, or entirely new people. Investors also have the aforementioned common fields as well as their own fields. How do I go about designing the table? 回答1: How about having a generic table people that would contain the common fields (name,

Inheritance & Database Design

痞子三分冷 提交于 2019-12-25 01:53:21
问题 When you model inheritance through class table inheritance relationships in a database model, do you... 1) Include an attribute (boolean for two subtipes, string for more subtipes) which identifies the particular subtipe of each record? 2) Include this identification as a foreign key to a table containing a description of all the possible subtypes? 3) None of the above and rely on "trial and error" lookup in subtables on the few times it is needed? 回答1: I would prefer in most cases the table