0% found this document useful (0 votes)
18 views7 pages

DBMS CA3 Suggested Topics

The document explains key concepts in Database Management Systems (DBMS) including the Three Schema Architecture, SQL types (DDL, DML, DCL), ER diagrams with various attribute types, keys, and integrity constraints. It also covers advanced topics like EER, normalization, functional dependencies, and the translation of ERD to tables. These concepts are essential for structured data storage, retrieval, and maintaining data integrity in relational databases.

Uploaded by

nirafi5002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views7 pages

DBMS CA3 Suggested Topics

The document explains key concepts in Database Management Systems (DBMS) including the Three Schema Architecture, SQL types (DDL, DML, DCL), ER diagrams with various attribute types, keys, and integrity constraints. It also covers advanced topics like EER, normalization, functional dependencies, and the translation of ERD to tables. These concepts are essential for structured data storage, retrieval, and maintaining data integrity in relational databases.

Uploaded by

nirafi5002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

DBMS Concepts Explained

explain each of the following concepts in dbms, with examples where necessary:-
- Introductory concepts - 3 schema architecture
- SQL types - DDL DML DCL
- ER diagram - types of attributes: Multivalued, composite, complex, derived.
- Degree and Cardinality of relation and relationships
- Concept of keys - super key, candidate key, primary key, foreign key
- Entity Integrity constraint
- Referential integrity constraint
- Weak and strong entities

Concepts in Database Management Systems (DBMS)

1. Introductory Concepts - Three Schema Architecture

The Three Schema Architecture in DBMS helps separate the database structure into three levels to
provide abstraction and data independence.

Internal Schema: The physical storage of data in memory (e.g., data files, indexes, hashing).
Conceptual Schema: The logical structure of the entire database (e.g., tables, relationships,
constraints).
External Schema: The user’s view of the data (e.g., reports, specific tables for applications).

Example:
A university database has:

Internal Schema storing student records in binary files.


Conceptual Schema defining tables like `Students(student_id, name, dob, course)`.
External Schema showing only `name` and `course` for a student’s academic report.

2. SQL Types - DDL, DML, DCL

SQL is categorized into three main types:

DDL (Data Definition Language): Defines and modifies database structure.


`CREATE TABLE students (id INT PRIMARY KEY, name VARCHAR(50));`
`ALTER TABLE students ADD COLUMN age INT;`
`DROP TABLE students;`
DML (Data Manipulation Language): Manages and manipulates data in the database.
`INSERT INTO students VALUES (1, 'John', 20);`
`UPDATE students SET age = 21 WHERE id = 1;`
`DELETE FROM students WHERE id = 1;`
DCL (Data Control Language): Controls access and permissions.

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 1/7
`GRANT SELECT ON students TO user1;`
`REVOKE INSERT ON students FROM user1;`

3. ER Diagram - Types of Attributes

In Entity-Relationship (ER) Diagrams, attributes define entity properties. Types include:

Multivalued Attribute: Can have multiple values.


Example: `PhoneNumbers` for an employee (`{1234567890, 9876543210}`).
Composite Attribute: Can be broken down into smaller sub-parts.
Example: `FullName` → `{FirstName, LastName}`.
Derived Attribute: Calculated from other attributes.
Example: `Age` derived from `DateOfBirth`.
Complex Attribute: Combination of composite and multivalued attributes.
Example: Address `{Street, City, (PhoneNumbers)}`.

4. Degree and Cardinality of Relation and Relationships

Degree of a Relation: Number of attributes (columns) in a relation (table).


Example: A table `Students(id, name, age)` has degree 3.
Cardinality of a Relation: Number of rows (tuples) in a relation.
Example: If `Students` has 100 records, its cardinality is 100.
Degree of a Relationship: Number of entities participating in a relationship.
Example:
Unary: Employee reports to Employee.
Binary: Student enrolls in Course.
Ternary: Supplier supplies Product to Store.

5. Concept of Keys

Super Key: A set of attributes that uniquely identify a row.


Example: `{StudentID, Name}` uniquely identifies a student.
Candidate Key: Minimal super key (no unnecessary attributes).
Example: `{StudentID}` (if it uniquely identifies students).
Primary Key: Chosen candidate key for table uniqueness.
Example: `StudentID PRIMARY KEY`.
Foreign Key: An attribute referring to a primary key in another table.
Example: `CourseID` in `Enrollment` table referencing `Courses(course_id)`.

6. Entity Integrity Constraint

Ensures that primary key attributes are not NULL in a relation.

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 2/7
Example:

sql

CREATE TABLE Students (


student_id INT PRIMARY KEY,
name VARCHAR(50) NOT NULL
);

A student record must have a unique `student_id` (not NULL).

7. Referential Integrity Constraint

Ensures foreign key values must exist in the referenced primary key table.

Example:

sql

CREATE TABLE Courses (


course_id INT PRIMARY KEY,
course_name VARCHAR(50)
);

CREATE TABLE Enrollment (


student_id INT,
course_id INT,
FOREIGN KEY (course_id) REFERENCES Courses(course_id)
);

`course_id` in `Enrollment` must match an existing `course_id` in `Courses`.

8. Weak and Strong Entities

Strong Entity: Has a primary key and exists independently.


Example: `Students(student_id, name)`.
Weak Entity: Has no primary key and depends on a strong entity. It uses a foreign key and a
partial key.
Example: `Dependents(dependent_name, student_id)`, where `student_id` is a foreign key
referencing `Students(student_id)`.

Conclusion

These concepts form the foundation of DBMS, ensuring structured data storage, retrieval, and integrity
across relational databases. Let me know if you need further clarification! 🚀

explain each of the following concepts in dbms, with examples where necessary:-
- EER: Generalisation specialisation
- Binary, tertiary, n-ary relationship
- Ternary to binary conversion
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 3/7
- ERD to table translation
- Simple SQL like CREATE, INSERT, UPDATE, DELETE, SELECT
- Functional dependencies, armstrongs axioms, Attribute closure
- Finding primary key for a given R with given FDs
- Normalization - 1NF, 2NF

Concepts in Database Management Systems (DBMS)

1. EER: Generalization and Specialization

EER (Enhanced Entity-Relationship) models extend ER models by introducing more complex


relationships like generalization and specialization.

Generalization: Combining multiple entity types into a higher-level entity.


Example: Entities Car and Bike can be generalized into a Vehicle entity.
Specialization: Breaking down a general entity into sub-entities based on specific attributes.
Example: Employee can be specialized into Manager and Technician.

Diagram Representation:

markdown

Vehicle
/ \
Car Bike

2. Binary, Ternary, and N-ary Relationships

Binary Relationship (Degree 2): Relationship between two entities.


Example: `Student` enrolls in `Course`.
Ternary Relationship (Degree 3): Relationship involving three entities.
Example: `Supplier` supplies `Product` to `Store`.
N-ary Relationship (Degree N): Relationship with more than three entities.
Example: `Doctor`, `Patient`, `Hospital`, and `Treatment` form a four-way (quaternary)
relationship.

3. Ternary to Binary Conversion

A ternary relationship can be converted into binary relationships by introducing an associative entity.
Example:
A `Supplier` supplies a `Product` to a `Store`.

Instead of having a single ternary relation:

lua

Supplier -- supplies --> Product


\

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 4/7
Store

We break it into two binary relationships:


`Supplier` supplies `Product`.
`Store` stocks `Product`.

This maintains clarity while preserving relationships.

4. ERD to Table Translation

Converting an ER Diagram (ERD) into relational tables involves:

1. Entities → Tables
`Student(student_id PRIMARY KEY, name, age)`
2. Attributes → Columns
3. Relationships → Foreign Keys
`Enrollment(student_id FOREIGN KEY REFERENCES Student(student_id), course_id FOREIGN KEY
REFERENCES Course(course_id))`
4. Multivalued Attributes → Separate Tables
`Student_Phone(student_id, phone_number)`.

5. Simple SQL Commands

CREATE TABLE: Define a new table.

sql

CREATE TABLE Students (


id INT PRIMARY KEY,
name VARCHAR(50),
age INT
);

INSERT: Add data.

sql

INSERT INTO Students VALUES (1, 'John', 20);

UPDATE: Modify existing data.

sql

UPDATE Students SET age = 21 WHERE id = 1;

DELETE: Remove data.

sql

DELETE FROM Students WHERE id = 1;

SELECT: Retrieve data.

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 5/7
sql

SELECT * FROM Students WHERE age > 18;

6. Functional Dependencies, Armstrong’s Axioms, and Attribute Closure

Functional Dependency (FD)

A functional dependency X → Y means that for each value of `X`, there is a unique value of `Y`.

Example: `StudentID → Name, Age` (A student ID determines name and age).

Armstrong’s Axioms (Rules for inferring FDs)

1. Reflexivity: If `Y ⊆ X`, then `X → Y`.


2. Augmentation: If `X → Y`, then `XZ → YZ`.
3. Transitivity: If `X → Y` and `Y → Z`, then `X → Z`.

Attribute Closure

The closure of an attribute set X, denoted as X⁺, is the set of attributes that can be functionally
determined by X.

Example:
For `R(A, B, C, D)` with FDs:

`A → B`
`B → C`
`C → D`

To find `A⁺`:

`A → B`, so `{A, B}`


`B → C`, so `{A, B, C}`
`C → D`, so `{A, B, C, D}`
Thus, `A⁺ = {A, B, C, D}`.

7. Finding Primary Key for Given Relation (R) with Given FDs

Steps:

1. Find Attribute Closure for candidate keys.


2. Check Minimality (remove unnecessary attributes).

Example:
Given `R(A, B, C, D, E)` with FDs:

`A → B`
`A → C`
`CD → E`
`B → D`

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 6/7
Find candidate keys:

Compute `A⁺`: `{A, B, C, D, E}` (contains all attributes, so `A` is a candidate key).
Primary Key = `{A}` (since it uniquely identifies all attributes).

8. Normalization - 1NF, 2NF

Normalization removes redundancy and ensures efficient database design.

1NF (First Normal Form)

Eliminates repeating groups; every column must have atomic values.


Example (Not 1NF):

scss

Student(ID, Name, Courses)


(1, 'John', {Math, Science})

has multiple values.


`Courses`
Convert to 1NF:

pgsql

Student(ID, Name, Course)


(1, 'John', 'Math')
(1, 'John', 'Science')

2NF (Second Normal Form)

Eliminates partial dependency (a non-key attribute depends on part of a composite key).


Example (Not 2NF):

scss

Enrollment(StudentID, CourseID, StudentName)

`StudentName` depends on `StudentID`, not `CourseID`, causing partial dependency.


Convert to 2NF:
`Student(StudentID, StudentName)`
`Enrollment(StudentID, CourseID)`

Conclusion

These DBMS concepts help design efficient, structured, and normalized databases. Let me know if you
need further explanations! 🚀

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 7/7

You might also like