Questions tagged [weak-entity]

In a relational database, a weak entity is an entity that cannot be uniquely identified by its attributes alone; therefore, it must use a foreign key in conjunction with its attributes to create a primary key.

In a relational database, a weak entity is an entity that cannot be uniquely identified by its attributes alone; therefore, it must use a foreign key in conjunction with its attributes to create a primary key. The foreign key is typically a primary key of an entity it is related to.

In entity relationship diagrams, ER diagrams a weak entity set is indicated by a bold (or double-lined) rectangle (the entity) connected by a bold (or double-lined) type arrow to a bold (or double-lined) diamond (the relationship). This type of relationship is called an identifying relationship and in IDEF1X notation it is represented by an oval entity rather than a square entity for base tables. An identifying relationship is one where the primary key is populated to the child weak entity as a primary key in that entity.

In general (though not necessarily) a weak entity does not have any items in its primary key other than its inherited primary key and a sequence number. There are two types of weak entities: associative entities and subtype entities. The latter represents a crucial type of normalization, where the super-type entity inherits its attributes to subtype entities based on the value of the discriminator.

When sub-type relationships are rendered in a database, the super-type becomes what is referred to as a base table. The sub-types are considered derived tables, which correspond to weak entities. Referential integrity is enforced via cascading updates and deletes.

18 questions
80
votes
12 answers

Example of a strong and weak entity types

I've tried to look on Google about a decent explanation of weak and strong entity type, but I haven't fully understood them. Could someone give me an example of a strong and weak entity type?
learner123
  • 961
  • 1
  • 10
  • 16
3
votes
1 answer

Can a weak entity be involved in both identifying and non-identifying relationships with other tables?

Obviously a weak entity must be involved (as the child) in one or more identifying relationships, otherwise it would not be weak. But can it, at the same time, also be the child in a non-identifying relationship?
S. Jackson
  • 31
  • 1
  • 2
3
votes
1 answer

ER diagram: Total participation and weak entities

So, in this semester I started learning about DBMS and the first two chapters was about ER systems. But even though i understand what is a weak entity and the definition of total participation I find it hard to distinguish what to use in…
Panos Kikas
  • 43
  • 1
  • 5
2
votes
2 answers

Partial Keys in a Weak Entity Set

I am a bit confused with the partial keys. 'Database System Concepts by Korth' says the following: Although the weak entity set does not have a primary key, we nevertheless need a means of distinguishing among all those entities in the weak…
Raju
  • 137
  • 1
  • 4
  • 11
2
votes
1 answer

Weak Entity in ERD

I have the following problem that I have multiple scenarios that might be right or wrong, I've been searching on this for a while and I didn't find a specific answer for my problem: Doctor Clinic Example: We have doctor, patient, treatment,…
Mohammad Shahhoud
  • 469
  • 3
  • 6
  • 16
1
vote
1 answer

There are no primary or candidate keys in the referenced table 'Card' that match the referencing column list in the foreign key

Create table scripts: Create Table [Card] ( GiveDate Date not null, PN nvarchar(50) not null, FOREIGN KEY (PN) REFERENCES Patient (PN), PRIMARY KEY (GiveDate,PN) ) Create table [Registration] ( EntryDate Date not null, …
Tariq Hajeer
  • 308
  • 2
  • 14
1
vote
1 answer

Need help designing my database

I have a given number of entities, 6 of which are related to one another. However 4 of them (Namely, JobInfo, Child, Spouse and ParentInfo) are linked to the main Person/Employee entity and this employee entity requires the primary key of the…
Rye
  • 35
  • 1
  • 5
1
vote
1 answer

SQLite: Insert into weak entity table (or how to get the just-inserted defining entity's ID)

I'm struggling with inserting proper key value to weak entity together with inserting the defining strong entity. These two entities: CREATE TABLE 'key' ( 'id' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, ... CREATE TABLE 'key_data_rsa' ( 'id_key'…
jficz
  • 271
  • 3
  • 8
1
vote
1 answer

Creating SQL Tables based on ERD with two Weak entities

Struggling with this issue i have. have been given a ERD that looks like this: ERD Diagram I am not sure how to join the 2nd Weak Entity (Charge Details) Below is the SQL that is throwing an error when attempting to insert data. CREATE TABLE…
Lachie White
  • 1,246
  • 2
  • 14
  • 21
0
votes
0 answers

Can card types be considered weak entity?

I am trying to do a ER Model for different types of Credit Card. I have an entity called Credit Card that has a relationship with another entity called Card Type. Would you consider the Card Type entity to be a weak entity? I am not quite sure…
0
votes
0 answers

Can we add a primary key to a weak entity?

I've learned that within a weak entity, each occurrence can't be uniquely identified using any available attributes within that entity. In other words, each occurrences can't be uniquely identified since there is no primary key. All the textbooks…
Todd
  • 399
  • 3
  • 18
0
votes
1 answer

Weak Entity postgresql

I want to create a table with primary key email,nro being nro a sequential number for each email ex: user1@e.com, 1 user1@e.com, 2 user2@e.com, 1 create table proposta_de_correcao( email varchar(255) not null, nro serial not null, …
0
votes
1 answer

How can a weak entity be related to weak entity?

As we can see in this image, ATTENDANCE entity is related to TRANSCRIPT entity? But how can entities in TRANSCRIPT be identified if there is no primary key in ATTENDANCE? Is the image wrong?
MrRobot9
  • 2,402
  • 4
  • 31
  • 68
0
votes
1 answer

How can I implement the customer and Account table shown in ER diagram in SQL

How can I implement the customer and Account table shown in ER diagram in SQL. Every customer has exactly 1 account. Every account belongs to exactly 1 customer. On customer being deleted, the associated account row should also be deleted
Chetan
  • 469
  • 3
  • 12
  • 27
0
votes
1 answer

Hibernate autoincrement ManyToOne weak entity

I was wondering whats the best way to autoincrement my order rows in hibernate? Starting at 1 and going up isn't a problem. But I want my order row id to reset when added to a new order. Pretty much like this: OrderID OrderRowID 1 1 1 …
Stefan
  • 981
  • 1
  • 9
  • 19
1
2