DBMS Assignment Answers (BBA 4th Semester)
1. Discuss about outer join with suitable example.
An outer join is a type of join in SQL that returns all records from one table and the matched records from
another. If there is no match, the result is NULL on the side that does not have a match.
Types of Outer Joins:
- LEFT OUTER JOIN: Returns all rows from the left table, and the matched rows from the right table.
- RIGHT OUTER JOIN: Returns all rows from the right table, and the matched rows from the left table.
- FULL OUTER JOIN: Returns rows when there is a match in either left or right table.
Example:
Table A
ID | Name
1 | Ram
2 | Shyam
3 | Riya
Table B
ID | Salary
1 | 10000
3 | 15000
4 | 12000
Query:
SELECT [Link], [Link] FROM A LEFT OUTER JOIN B ON [Link] = [Link];
DBMS Assignment Answers (BBA 4th Semester)
Result:
Name | Salary
Ram | 10000
Shyam | NULL
Riya | 15000
2. Define instance and schema? List different data models and explain.
Instance: An instance of a database refers to the collection of data at a particular moment.
Schema: A schema is the logical structure of the database, describing how the data is organized and how the
relationships are associated.
Different Data Models:
1. Hierarchical Model: Data is organized in a tree-like structure (Parent-child relationship).
2. Network Model: Each record can have multiple parent and child records.
3. Relational Model: Data is stored in tables (relations). Widely used model.
4. Object-Oriented Model: Data is stored in objects, supporting complex data types.
5. Entity-Relationship Model: Uses ER diagrams to represent data and relationships visually.
3. Explain 1NF, 2NF, BCNF with suitable example.
1NF (First Normal Form):
- Ensures that the table has only atomic (indivisible) values.
- Each record must be unique.
DBMS Assignment Answers (BBA 4th Semester)
Example:
Before: (1, 'Amit', 'Math, Physics')
After: (1, 'Amit', 'Math')
(1, 'Amit', 'Physics')
2NF (Second Normal Form):
- Must be in 1NF and have no partial dependency.
Example:
Before: (StudentID, CourseID, CourseName, StudentName)
After:
(StudentID, CourseID, StudentName)
(CourseID, CourseName)
BCNF (Boyce-Codd Normal Form):
- A stricter version of 3NF where every determinant is a candidate key.
Example:
Table: (StudentID, Course, Instructor)
Course -> Instructor violates BCNF.
Split into:
(Course, Instructor)
(StudentID, Course)
4. Discuss about purpose of database systems?
Purposes of Database Systems:
DBMS Assignment Answers (BBA 4th Semester)
1. Data Management: Efficiently stores and manages structured data.
2. Data Sharing: Enables simultaneous access by multiple users and applications.
3. Data Integrity: Ensures accuracy and consistency.
4. Data Security: Protects against unauthorized access.
5. Data Independence: Application and data are separated.
6. Reduced Redundancy: Minimizes data duplication.
7. Backup and Recovery: Supports automatic data backup and restore.