Strong vs Weak entities MYSQL

entity-framework mysql sql

Question

I have to make two distinct tables in MySQL/SQL to display the numbers Differences between powerful and feeble creatures.

Someone please provide me an example of how I would go about doing this.

I am aware that while a weak entity cannot exist without a strong one, the reverse is not true. So, for instance, the following would constitute a powerful entity:

Employee(EmpNo, Name, EmpId)

?

But I'm not sure how to make a table that compares the two.

1
2
3/21/2016 3:34:31 PM

Accepted Answer

Consider theEmployee the following columns in a table:

EmployeeID , EmpName, EmpDept,...

The Managers table might look like:

ManagerID, EmployeeID(foreign-key),ManagerName,...

Currently, each A manager is a worker. is a Manager in the event that one exists.Manager table, the identical entry would appear inEmployee table.

The "is a" connection is kept:Each manager is a Employee but each Employee is not a Manager


The inquiry might be along these lines:

CREATE TABLE Employee
(
EmployeeID int NOT NULL,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255),
PRIMARY KEY (EmployeeID)
)

CREATE TABLE Managers
(
ManagerID int NOT NULL,
EmployeeID int NOT NULL,
..
...
FOREIGN KEY (EmployeeID) REFERENCES Employee(EmployeeID)
)
1
4/17/2015 6:03:26 AM

Popular Answer

As you are aware, a weak entity is a table without a primary key, such as However, the strong entity set's main key, upon which the existence of the weak entity set depends, is used to create the primary key of a weak entity set., plus the discriminator for the weak entity set.

Relation between Strong and week entity

An identifying relationship exists between a weak entity and a strong entity collection. The loan-payment relationship serves as the payment entity's identifying relationship in the case shown in the above figure. As seen in the illustration, a weak entity set is represented by a doubly outlined box, and the matching identifying relation is represented by a doubly outlined diamond. Here, double lines represent the whole involvement of a weak entity in the strong entity set, indicating that every payment must be connected to an account via a loan payment. Each payment is for a separate loan, as indicated by the arrow from loan-payment to loan. Instead of solid lines, a weak entity set's discriminator is highlighted by dashed lines.

Let's think about a different case where we need to store employee and dependent information. Each employee may have anything between 0 and n dependents. Each dependent has a name and an ID number.

Let's now have a look at the data base below:

There are three employees, with their respective E#s being 1, 2, and 3.

Employee having E# 1, has two dependents as 1, Rahat and 2, Chahat.

Employee having E# 2, has no dependents.

Employee having E# 3, has three dependents as 1, Raju; 2, Ruhi; 3 Raja.

Because it is not unique, the dependent entity id cannot be used as the primary key.

Since id serves as a discriminator, Dependent is a weak entity set. It participates fully in the partnership, as no dependant could exist without the employees (the company is concerned with employees).

There are two tables need to created above e-r diagram. These are employees, and the only column with the value E# serves as the primary key. The other table will be dependent and have columns for E#, id, and name. Its primary key will be the union of (E# and id).



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow