Mis Lab

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

1) Design and create a database schema for a small online bookstore.

Include tables for books, authors, customers, and orders. Provide SQL
commands for table creation and insert sample data.

Creating authors table

Creating books table

Creating customers table

Creating orders table


Inserting data into authors table

Inserting data into customers table

2) Write an SQL query to find all customers who have purchased books in
the last 30 days, along with the book titles and order dates.

3) Given a sample un normalized table containing customer orders,


normalize the table up to the Third Normal Form (3NF). Explain each
step.
Suppose, we have a table:

First Normal Form (1NF)


To achieve 1NF, we need to eliminate repeating groups and ensure that each cell contains a
single value. We can do this by creating a new table,OrderItems, that contains one row for
each item in an order.

Second Normal Form (2NF)


To achieve 2NF, we need to ensure that each non-key attribute depends on the
entire primary key. In this case, the primary key is “OrderId”, but the “Customer”
attribute depends only on the “OrderId” not on the “Item”. We can move the
“Customer” attribute to a separate table, “Orders”, and create a foreign key
relationship between “Orders” and “OrderItems”.
Third Normal Form (3NF)
To achieve 3NF, we need to ensure that there are no transitive dependencies. In this
case, the “Price” attribute depends on the “Item”, not on the “OrderID”. We can
move the “Price” attribute to a separate table, ”Items”, and create a foreign key
relationship between “OrderItems” and “Items”.

4) Given a list of entities and their attributes, create an Entity-Relationship


Diagram (ERD) and identify the primary and foreign keys.
5) Write SQL queries using INNER JOIN, LEFT JOIN, and RIGHT JOIN to
retrieve data from multiple tables. Provide examples and explain the
differences between each type of join.

Lets, suppose we have “Customers” and “Orders” tables.

INNER JOIN
An INNER JOIN returns only the rows that have a match in both tables.
LEFT JOIN
A LEFT JOIN returns all the rows from the left table and the matching rows from the
right table. If there is no match, the result is NULL on the right side.

RIGHT JOIN
A RIGHT JOIN is similar to a LEFT JOIN, but it returns all the rows from the right table
and the matching rows from the left table.

6) Create a Data Flow Diagram for a library management system. Include


processes like book borrowing, returning, and catalog management.

DFD Level 0 Diagram for Library Management System


7) Draw an ERD for a student management system. Include entities such
as students, courses, instructors, and enrollments.

8) Develop a Use Case Diagram for an online ticket booking system.


Identify the actors and use cases.
9) Describe and draw the high-level architecture of a Customer
Relationship Management (CRM) system. Include components like the
user interface, application server, and database server.
The three components of CRM are as follows:

i) CRM Strategy
Customer relationship management is a strategy that reinforces the
continuous nurturing of customer relationship to increase revenue and
profitability. Despite a standard focus on building customer relationships,
every company will have its own slightly different take on what its CRM
strategy should look like. What won’t change is the role of CRM strategy as
the high-level, big-picture outline of a CRM architecture.

ii) CRM Structure


If strategy is the big picture, a CRM structure is a more detailed map of the
components that make up that strategy. The structure will be tailored to a
company’s sales cycle, customer journey, and customer profiles to provide a
practical roadmap for achieving CRM goals.
In terms of software, a CRM will be structured with specific fields, modules,
and integrations that support customer contact, service delivery, and data
collection.

iii) CRM Process


Processes are the final pieces of the CRM architectural puzzle. Processes
outline the more practical considerations and actionable aspects of
executing on customer relationship management, including the how and
when of dealing with customers on an individual level. Think of these as the
“if this, then that” scenarios of the customer journey.

10) Write SQL commands to perform Create, Read, Update, and


Delete (CRUD) operations on a table in a database. Provide examples
and explain each operation.

Create Operation
The Create operation is used to create a new table.
Insert Operation
This command inserts a new row into the "customers" table with the name "John
Doe” and email [email protected]

Read Operation
The Read operation is used to retrieve data from a table

Update Operation
The Update operation is used to modify existing data in a table. This command updates
the email address of the customer with the name "John Doe" to "[email protected]".

Delete Operation
The Delete operation is used to delete data from a table. This command deletes the row
from the "customers" table where the name is "John Doe".

11) Create a stored procedure to calculate the total sales for a specific
month. Demonstrate how to execute this procedure.
This stored procedure takes two input parameters: @month and @year, which
represent the month and year for which we want to calculate the total sales. The
procedure uses a SELECT statement to sum up the ‘Total’ column of the ‘Sales’ table,
filtering the results to only include sales that occurred in the specified month and year.
To execute the stored procedure, we can use the following command:

Output:

12) Write a trigger that automatically updates the stock quantity in


the database whenever a new order is placed.

Here is an example of a trigger that updates the stock quantity in the database
whenever a new order is placed:

This trigger is created on the Orders table and is triggered after a new order is
inserted. The trigger updates the StockQuantity column of the Products table by
subtracting the quantity of the product ordered from the current stock quantity.
13) Design a simple form in a database management system to enter
new customer details. Create a report to display all customers and their
contact information.

To create form SQL code:

To display customers information:

Output:
14) Discuss methods for encrypting sensitive data in a database.
Provide an example of how encryption can be implemented in SQL.

Encrypting sensitive data in a database is crucial for protecting it from unauthorized


access and ensuring data privacy and security. There are several methods to encrypt
data, including:
 Column-level encryption: Encrypting specific columns that store
sensitive information.
 Transparent Data Encryption: Encrypting the entire database or
specific tablespaces.
 Application-level encryption: Encrypting data before it is sent to the
database, often using application code.
 File-level encryption: Encrypting the entire database file or specific files
storing sensitive data.

Encryption with ‘AES-ENCRYPT’

15) Explain how to set up user roles and permissions in a database


management system. Provide examples of different access levels.

Steps included in setting up user roles and permissions:


 Create a User account.
 Define Roles.
 Assign Permissions.
 Assign Role to Users.
16) Describe the steps to back up a database and restore it from a
backup. Why is regular backup important?

Steps to backup a database:

 Choose a backup method.


 Select backup options.
 Schedule the backup.
 Store the backup.

Steps to restore from a backup:

 Stop the database server.


 Delete the existing server.
 Restore the backup.
 Verify the restore.
 Start the database.

Regular backup is important because of the following reasons:

 Data loss prevention: Regular backups ensure that data is safe in case of
hardware failure, software corruption, or human error.
 Business continuity: Backups enable quick recovery in case of a disaster,
minimizing downtime and ensuring business continuity.
 Version control: Backups provide a history of changes, allowing for easy
rollbacks to previous versions if needed.

17) Explain how indexing can improve the performance of SQL


queries. Provide an example of creating an index for a specific query.

Indexing is a technique used in databases to improve the performance of SQL


queries by allowing the database to quickly locate and retrieve the required data.
An index is a data structure that contains a copy of selected columns from a table,
along with a pointer to the location of the corresponding rows in the table.

Here are some ways that indexing can improve the performance of SQL queries:
 Faster data retrieval.
 Reduced disk I/O.
 Improved query optimization.
 Better support for filtering and sorting.
Creation of Index:

18) Describe techniques for tuning a database to improve


performance. Discuss how to identify and address performance
bottlenecks.

Techniques for tuning a database to improve performance:

 Indexing.
 Optimize Queries.
 Partitioning.
 Caching
 Database Fragmentation.

Identifying Bottlenecks:
 Use Database Performance Monitoring Tools.
 Analyze Query Execution Plans.
 Monitor System Resources.
 Collect Database Statistics.

19) Develop a basic implementation plan for a new MIS in a small


business. Include phases such as planning, design, development,
testing, and deployment.

Basic Implementation Plan for a New MIS in a Small Business:

Phase 1: Planning (Weeks 1-4)

 Define Project Scope and Objectives:

Identify the business needs and goals for the new MIS.
Determine the key performance indicators (KPIs) to be tracked.
Establish a project timeline and budget.
 Conduct a Needs Assessment:
Interview stakeholders to gather requirements.
Analyze existing business processes and systems.
Identify areas for improvement and opportunities for automation.

 Develop a High-Level Design:


Create a conceptual design for the MIS.
Identify the required hardware, software, and infrastructure.
Determine the data architecture and integration requirements.

Phase 2: Design (Weeks 5-8)

 Develop a Detailed Design:

Create a detailed design document outlining the MIS architecture.


Define the data models, workflows, and business rules.
Identify the required reports and dashboards.

 Design the Database:


Create a database design document outlining the schema and data
structures.
Define the data relationships and normalization rules.

 Develop a User Interface (UI) Prototype:

Create a UI prototype to demonstrate the system's functionality and


usability.
Gather feedback from stakeholders and refine the design.

Phase 3: Development (Weeks 9-16)

 Develop the MIS:


Build the MIS using the chosen technology stack.
Implement the database design and data models.
Develop the required reports and dashboards.

 Implement Business Logic and Workflows:


Develop the business logic and workflows outlined in the design document.
Implement data validation, error handling, and security measures.

 Integrate with Existing Systems:


Integrate the MIS with existing systems and data sources.
Develop APIs and data interfaces as required.

Phase 4: Testing (Weeks 17-20)

 Unit Testing:
Test individual components and modules of the MIS.
Ensure that each component functions as expected.

 Integration Testing:
Test the integrated system to ensure that all components work together
seamlessly.
Identify and resolve any integration issues.

Phase 5: Deployment (Weeks 21-24)

 Deploy the MIS:

Deploy the MIS to the production environment.


Configure the system for optimal performance and security.

 Train End-Users:

Provide training and support to end-users.


Ensure that users understand how to use the system effectively.

 Post-Implementation Review:
Conduct a post-implementation review to identify lessons learned.
Refine the system and make any necessary adjustments.

You might also like