Notes 1
Notes 1
3. What are weak entity sets? Explain with an example and their representation in ER diagrams.
Answer:
• Definition:
o Entities that depend on a strong entity for existence (they do not have a primary key of their
own).
• Example:
o Dependent in an insurance database that relies on Employee.
• ER Representation:
o Weak entity: Represented with a double rectangle.
o Identifying relationship: Represented with a double diamond.
o The primary key is formed by combining the owner’s key with a partial key (for example,
Employee_ID + Dependent_Name).
4. Compare Super Key, Candidate Key, and Primary Key with examples.
Answer:
• Super Key:
o Any set of attributes that uniquely identifies an entity.
o Example: {Student_ID, Name} for a Student table.
• Candidate Key:
o A minimal super key with no redundant attributes.
o Example: Student_ID alone is sufficient.
• Primary Key:
o The chosen candidate key for unique identification.
o Example: Student_ID is selected as the primary key.
10. What is the role of DDL and DML in databases? Provide SQL examples.
Answer:
• DDL (Data Definition Language):
o Used to define or modify the database structure.
o Example:
o CREATE TABLE Student (
o Student_ID INT PRIMARY KEY,
o Name VARCHAR(50)
o );
• DML (Data Manipulation Language):
o Used to manage data within tables.
o Example:
o INSERT INTO Student VALUES (101, 'Alice');
o SELECT * FROM Student;