relational-database

Multiple relations parent/child with multiple levels

最后都变了- 提交于 2020-01-07 04:35:14
问题 I have a MySQL table named companies like this: +---------+-----------+-----------+ | id_comp | comp_name | id_parent | +---------+-----------+-----------+ | 1 | comp1 | NULL | | 2 | comp2 | 1 | | 3 | comp3 | 2 | | 4 | comp4 | 2 | | 5 | comp5 | 2 | | 6 | comp6 | 1 | | 3 | comp3 | 6 | | 5 | comp5 | 6 | | 7 | comp7 | 6 | | 4 | comp4 | 6 | | 8 | comp8 | 4 | +---------+-----------+-----------+ Each company may have multiple parents (ex: comp3 , which is child of comp2 and comp6 ), each parent may

MVC Entity Framework Mapping Correct but Tables incorrect

廉价感情. 提交于 2020-01-06 20:13:19
问题 I'm currently making a ticketing system using MVC4 Entity Framework. Relations between 3 classes User to Admin = 1:0...1 1 to 0 or 1 = Few users will have admin status but not all. Admin to Ticket = 1:*|1 to Many = Admins can be assigned with more than 1 ticket but one ticket can only be assigned to one admin User to Ticket = 1:*|1 to Many = Users can open multiple tickets but one ticket can only have one user. Here are what my current tables look like. My issue is why is my admin table

Hibernate Storing Fields inside Classes

孤人 提交于 2020-01-06 17:08:22
问题 I have two classes with two individual tables, "Employee" and "Company". I would like to keep a list of employee inside Company class. It is easy but I do not know how to represent this list in the database side. Class 'Company': @Entity @Table(name = "company") public class Company { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private Integer id; @Column(name = "name") private String name; private List<Employee> employeeList; } Class 'Employee': @Entity

Graph or Relational DB specifically recursion

大城市里の小女人 提交于 2020-01-06 15:21:33
问题 I am about to develop a solution for a customer where the basic entity is a member and members can have different multiple social relationships with other members. For instance Lets say we have four types of members Doctors, Specialist, Nurses and Patients. So one or more Doctors can consult one or more Specialists, One or more Doctors can treat one or more Patients. One or more Doctor is in Charge of one or more Nurses. So if I were to use a Relational DB a high degree of recursion would be

Which unique id to use for blogs and comments?

你说的曾经没有我的故事 提交于 2020-01-06 14:15:51
问题 This is a question that arose from the consequences of another question here: Is it better to have two separate user tables or one? Assuming I have two types of users, an Author and a Reader, each stored in relational tables keyed to a main Accounts table like so: TABLE Accounts { id email password salt created modified } TABLE reader { id user_id ... } TABLE author { id user_id ... } When an Author posts a blog, should I tag the blog with the unique id from the Authors table, or the unique

Generate UML from a conceptual data model

随声附和 提交于 2020-01-06 08:41:46
问题 I have an conceptual data model (Relational model) created using powerAMC for my database but i wanted to generate DAO from it using acceleo and for that i need it in UML , is there a way to generate UML from a conceptual data model model ? 回答1: Acceleo can generate code from any models defined with any EMF based metamodel . The UML project of the Eclipse Foundation defines an UML metamodel based on EMF so that users can create UML models based on EMF and Acceleo can thus generate code from

Can Entity Framework be used when relational data is missing?

本秂侑毒 提交于 2020-01-06 07:00:12
问题 I am creating a web site, and the data will be sent in from an external application that has a database full of data, only parts of which are needed for the web site. By "parts" I mean some of the rows in each table, but not all of them. The business in hand is one that manages charity vouchers, and they have customers who have accounts with them. Charities may want to log in to the web site and see info about money paid to them, and customers may want to log in and see info about their

Can Entity Framework be used when relational data is missing?

徘徊边缘 提交于 2020-01-06 07:00:11
问题 I am creating a web site, and the data will be sent in from an external application that has a database full of data, only parts of which are needed for the web site. By "parts" I mean some of the rows in each table, but not all of them. The business in hand is one that manages charity vouchers, and they have customers who have accounts with them. Charities may want to log in to the web site and see info about money paid to them, and customers may want to log in and see info about their

Mysql: Change status of all child records if status of parent is updated

梦想与她 提交于 2020-01-06 03:27:05
问题 I have 2 tables 1. Parent Parent_ID(PK)| name | status -------------------------------- 1 |parent 1 |enable 2 |parent 2 |enable 3 |parent 3 |disable 2. Child Child_Id(PK)| Parent_ID(Fk of parent table) | name | status ---------------------------------------------------------- 1 |1 | child 1 | enable 2 |1 | child 2 | enable 3 |1 | child 3 | enable 4 |1 | child 4 | enable 5 |2 | child 5 | enable 6 |2 | child 6 | enable 7 |2 | child 7 | enable 8 |2 | child 8 | enable 9 |3 | child 9 | disable 10

How can I store resource available by date (year/month/day/our) in database?

狂风中的少年 提交于 2020-01-05 08:43:49
问题 I have a program which manage resources (agents). In the program there is a feature to select a date from a calendar (e.g.: 08/11/2013 5 a.m.) and get back the number of available resources at selected time. How can I store the status of the resources for every hour of all day in the year effectively in a relational database? Resource status just a string: "accessible" or "busy". Have you any idea or strategy for this? Thanks for help! 回答1: The best way to store effective date(/time) ranges