Dbms
Dbms
Ans: RDBMS− provides an interface between users and applications and the database, as well
as administrative functions for managing data storage, access, and performance.
Enforce schema on a table, that is, every row has the same columns and a given
column has the same data type on every row, etc.
Enforce referential integrity between tables.
Implement transactions.
Manage concurrent access to data with fine-grained locking.
Index data for faster searches.
Provide a domain-specific language for querying data (SQL).
Enforce user authentication and access privileges.
Implement an efficient client/server protocol so clients on multiple remote hosts
can access data concurrently.
Example: CREATE TABLE Customers (ID INT, Name VARCHAR(50), Email VARCHAR(100));
2.ALTER: DDL command used to modify the structure of an existing database object, like adding or
dropping columns, constraints, or indexes.
3.DROP: DDL command used to delete a database object, such as a table, index, or view.
4.TRUNCATE: DDL command used to remove all data from a table but retain the table structure for
future use.
2.INSERT: DML command used to add new data records into a table.
Example: INSERT INTO Products (ProductID, Name, Price) VALUES (101, 'Widget', 19.99);
Example: UPDATE Customers SET City = 'New City' WHERE CustomerID = 101;
5.MERGE (or UPSERT): DML command used to perform an "upsert" operation, which means either
inserting a new row or updating an existing row based on certain conditions.
6.CALL (or EXECUTE): DML command used to execute stored procedures or user-defined functions.
Relational model can represent as a table with columns and rows. Each row is known as a
tuple. Each table of the column has a name or attribute.
Example: A relational database table that stores customer information, with tables for
orders, products, and relationships established through keys.
Advantages:
1.Simplicity and ease of understanding.
2.Supports complex queries and data retrieval through SQL.
3.Well-established and widely adopted in modern database systems.
Disadvantages:
4.Limited support for representing hierarchical or graph-like data structures.
5.Performance can be an issue with large datasets.
4. Entity-Relationship Model:
ER model stands for an Entity-Relationship model. It is a high-level data model. This model is used to
define the data elements and relationship for a specified system.
Example: A model used to design a database schema, representing entities (e.g., customers,
orders) and their relationships.
Advantages:
1.A powerful tool for designing database structures.
2.Helps in visualizing and communicating data requirements.
Disadvantages:
1.It's a design model, not a data storage model.
2.Doesn't provide a direct way to implement databases; it's used for schema design.
5. Object-Oriented Data Model:
The object-oriented data model aims at bridging the semantic gap between relation tables
and entities of the real world through objects that directly correspond to entities
Example: Storing and managing objects with their data and methods in a database.
Advantages:
1.Well-suited for modeling real-world objects.
2.Supports encapsulation, inheritance, and polymorphism.
Disadvantages:
1.Not as widely adopted as the relational model.
2.Can be complex to implement and query.
6. Document Data Model:
Data is stored in documents (unlike other databases that store data in structures like tables
or graphs). Documents map to objects in most popular programming languages, which
allows developers to rapidly develop their applications.
Example: Storing data in a semi-structured format like JSON or XML.
Advantages:
1.Flexible and suitable for unstructured or semi-structured data.
2.Well-suited for web applications and NoSQL databases.
Disadvantages:
1.May not be as efficient as the relational model for structured data.
2.Querying can be more complex due to the flexibility of data structures.
7. Graph Data Model:
Graph data modeling is the process in which a user describes an arbitrary domain as a
connected graph of nodes and relationships with properties and labels.
Example: Modeling complex relationships and networks, like social networks or hierarchical
structures.
Advantages:
1.Excellent for representing graph-like structures.
2.Well-suited for applications requiring traversal of relationships.
Disadvantages:
1.Less suitable for traditional tabular data.
2.Can be complex to implement and query.
Q.4 Draw neat and clean ER Diagram for Student Management System,
which stores the data about: a. Student (id, name, program) b. Course
(course name, year, semester, syllabus) c. Instructor (id, name, course,
subject, year, semester) Give the appropriate mapping constraints.
Ans:
Entities:
Student
Attributes:
Entities:
Course
Attributes:
Course Name
Year
Semester
Syllabus
Entities:
Instructor
Attributes:
ER Diagram
Q.5 What is data abstraction and data independence? Explain their types.
Ans: Data Abstraction
Data abstraction is the process of hiding the complex internal details of how data is stored
and structured from the end users and applications. It provides a simplified and organized
view of data, allowing users to interact with the data without needing to understand the
underlying complexities. Data abstraction is achieved through the use of data models and
abstraction layers.
Type of Data Abstraction-
1. Physical data Abstraction:
The lowest level is physical, and it tells how storing of data takes place in memory.
It uses access methods, including random or sequential access and file organization
methods including B+ trees or hashing. While designing the database, the factors
required are memory size and the number of times it records.
This is the intermediate level and consists of the information in the form of tables
stored in the database. The information available at the view level is unknown at
this level.
3. View:
The highest level is the view, and at this level, only some part of the database is
visible to the users. The user gets the ease of access to use the database at this
level. Data is present in the form of rows and columns for the users.
Data Independence:
Data independence is the separation of the application programs from the details of
data storage and organization. It ensures that changes made to the physical or
logical structure of the database do not require modifications to the application
programs that use the data.
This level of data independence means the modification of physical schema without
making any alterations in the logical schema, which is done for optimization.