entity-relationship

How to get ER model of database from server with Workbench

Deadly 提交于 2019-12-18 09:59:09
问题 Is there any way to get an ER model of a database from the server that is connected to my MySQL Workbench? 回答1: Go to "Database" Menu option Select the "Reverse Engineer" option. A wizard will be open and it will generate the ER Diagram for you. 回答2: I want to enhance Mr. Kamran Ali's answer with pictorial view. Pictorial View is given step by step: Go to " Database " Menu option Select the " Reverse Engineer " option. A wizard will come. Select from " Stored Connection " and press " Next "

Violation of 3NF if we use an auto-incremented identity column along with a PK

巧了我就是萌 提交于 2019-12-18 07:16:15
问题 As it is said in the book of Database Solutions Second Edition written by Thomas Connolly and Carolyn Begg page 180: Third normal form (3NF) A table that is already in 1NF and 2NF, and in which the values in all non-primary-key columns can be worked out from only the primary key column(s) and no other columns. I have seen many scenarios where people use an identity column though they already have a primary key column in their table. A record can also be worked out from the identity column, so

JPA - Entity design problem

烈酒焚心 提交于 2019-12-17 16:22:52
问题 I am developing a Java Desktop Application and using JPA for persistence. I have a problem mentioned below: I have two entities: Country City Country has the following attribute: CountryName (PK) City has the following attribute: CityName Now as there can be two cities with same name in two different countries, the primaryKey for City table in the datbase is a composite primary key composed of CityName and CountryName . Now my question is How to implement the primary key of the City as an

Implementing one-to-zero-or-one relation in SQL Server

喜欢而已 提交于 2019-12-17 09:45:31
问题 I'm using Entity Framework 4.1 database first approach. I've used legacy database. In my edmx file which created entity classes based on tables in the legacy database, there is a one-to-zero-or-one association between some entities. Although I explored the tables of database and relation between them I didn't find out how one-to-zero-or-one relation have been implemented in database. For more information I put some screenshots of my database diagram and the property of its relation and

is optionality (mandatory, optional) and participation (total, partial) are same?

浪尽此生 提交于 2019-12-17 04:00:12
问题 As i know optionality means the minimum cardinality of a relationship which is denoted as optional to optional, mandatory to optional, mandatory to mandatory.. And Participation denoted as bold line and a normal line. In the Internet some refer participation as the dependency of the entity to the relationship which is also looks like identifying and non identifying relationship. and some refer it as the minimum cardinality What is the correct definitions of those relationships and what is the

Turn off constraints temporarily (MS SQL)

江枫思渺然 提交于 2019-12-17 02:26:22
问题 I'm looking for a way to temporarily turn off all DB's constraints (eg table relationships). I need to copy (using INSERTs) one DB's tables to another DB. I know I can achieve that by executing commands in proper order (to not break relationships). But it would be easier if I could turn off checking constraints temporarily and turn it back on after the operation's finish. Is this possible? 回答1: You can disable FK and CHECK constraints only in SQL 2005+ . See ALTER TABLE ALTER TABLE foo

Should this ER diagram use a ternary relationship instead

橙三吉。 提交于 2019-12-14 02:18:24
问题 I've been looking at examples of ER diagrams to better understand them. I came across an ER diagram that I am not sure is correct. Here is the question/specification: UPS prides itself on having up-to-date information on the processing and current location of each shipped item. To do this, UPS relies on a company-wide information system. Shipped items are the heart of the UPS product tracking information system. Shipped items can be characterized by item number (unique), weight, dimensions,

EF 4.1 Code First - Mapping a one to one relationship with non standard column names

梦想的初衷 提交于 2019-12-13 19:15:46
问题 I know a lot of people is asking about one-to-one relationships on EF 4.1 but I can't seem to find an answer for this problem. I have these POCO classes: public class Contact { public decimal nCont_id { get; set; } public virtual WebsiteMembership WebsiteMembership { get; set; } //a bunch of other properties } public class WebsiteMembership { public int WebsiteMembershipId { get; set; } public virtual Contact Contact { get; set; } } Website membership's primary key (WebsiteMembershipId) is

EF4 - Force order of execution

一曲冷凌霜 提交于 2019-12-13 14:59:04
问题 I have three tables - Context, Session and User. And below are their simplified structure. User: UserId (Int, PK) Email (Varchar(100)) Context: ContextId (Int, PK) UserId (Int, FK from User table) CurrentSessionId (Int, Nullable, FK from Session table) Session: SessionId (Int, PK) UserId (Int, FK from User table) ContextId (Int, FK from Context table) Below is the sequence in my code to delete a user entity. 1) Update CurrentSessionId of Context table to null where UserId = UserId to be

Relational design scenario: restrict children relations

穿精又带淫゛_ 提交于 2019-12-13 14:27:39
问题 please consider the following scenario. An pet owner may have multiple cats, and may also have multiple dogs. Some of the dogs are related (ie they fight :-) ) with some of the cats of the same owner . The following relational design does not impose this restriction, as Cats and Dogs of different owners may be related. Is there a way to impose this restriction by relational design? 回答1: You'd need to use identifying relationships to migrate the owner's PK down both "sides" and to the "bottom"