0% found this document useful (0 votes)
2 views

Assignment_1[1] dbms

The document outlines an assignment for a Database Management System course, submitted by Abhishek Kumar to Ms. Surabhi Sankar. It includes fill-in-the-blank questions related to database concepts and a simulation-based task to design a database for an Online Library Management System, detailing the creation of tables and SQL queries for various operations. The assignment covers database structure, manipulation operations, and examples of inserting, updating, and deleting records.

Uploaded by

abhiclips441
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Assignment_1[1] dbms

The document outlines an assignment for a Database Management System course, submitted by Abhishek Kumar to Ms. Surabhi Sankar. It includes fill-in-the-blank questions related to database concepts and a simulation-based task to design a database for an Online Library Management System, detailing the creation of tables and SQL queries for various operations. The assignment covers database structure, manipulation operations, and examples of inserting, updating, and deleting records.

Uploaded by

abhiclips441
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Database Management System

Course Code: ETCS307A


Assignment 1
Section-A

SUBMIITED BY:
ABHISHEK KUMAR

SUBMIITED TO:
Ms. SURABHI SANKAR

ROLL NUMBER: 2301010322


COURSE: BTECH CSE CORE
SECTION: E

School of Engineering & Technology


K. R. MANGALAM UNIVERSITY
Sohna, Haryana 122103, India
Q1 Fill in the blanks:
a) Data abstraction is a database system architecture concept that shields users
from the complexities of how data is stored, allowing for easy interaction.
b) Achieving data data independence means that changes to the database
schema won't impact the applications using the data, ensuring a level of
insulation.
c) Using ddl users define the structure of a database, specifying data types,
relationships, and constraints to organize information effectively.
d) Scheme design involves the creation and modification of tables, indexes,
and constraints, shaping the foundation of a database's structure.
e) With data manipulation language users can perform operations like
inserting, updating, and deleting records, shaping the dynamic aspect of
database interaction.
Section-B (Simulation-based)
Q2 Design a database for an Online Library Management System. The system should store
information about books, authors, and library members. Each book has a unique ISBN, title,
and is associated with an author. Each author has a unique ID, name, and biography. Members
of the library have a unique ID, name, and can borrow multiple books.

FIRST CREATE DATABASE AND USE THAT DATABASE--


create database library;
use library;

1. Create a table named Authors with columns:


• AuthorID (Primary Key)
• Name
• Biography

SQL QUERY:-

create table authors(


author_id int primary key,
authorname varchar(20),
biography varchar(255)
);

2. Create a table named Books with columns:


• ISBN (Primary Key)
• Title
• AuthorID (Foreign Key referencing Authors)

SQL QUERY:-

create table Books(


isbn int primary key,
title varchar(20),
author_id int,
foreign key(author_id) references authors(author_id)
);

3. Create a table named Members with columns:


• MemberID (Primary Key)
• Name

SQL QUERY:-

create table members(


member_id int primary key,
membername varchar(20)
);
4. Create a table named BorrowedBooks with columns:
• TransactionID (Primary Key)
• MemberID (Foreign Key referencing Members)
• ISBN (Foreign Key referencing Books)
• BorrowDate
• ReturnDate

SQLQUERY :-

create table borrowbooks(


transaction_id int primary key,
member_id int,
isbn int,
borrowdate date,
returndate date,
foreign key(member_id) references members(member_id),
foreign key(isbn) references books(isbn)
);

Database Manipulation Operations:


5. Insert three authors into the Authors table.
→ INSERT INTO authors (author_id, authorname, biography)
VALUES
(1, 'J.K. Rowling', 'British author best known for the Harry Potter series.'),
(2, 'George Orwell', 'English novelist and essayist, famous for 1984 and Animal
Farm.'),
(3, 'Agatha Christie', 'English writer known for her detective novels and short
stories.');

6. Insert five books into the Books table, associating them with the authors created in step
→ INSERT INTO Books (isbn, title, author_id)
VALUES
(101, 'Harry Potter', 1),
(102, '1984', 2),
(103, 'Animal Farm', 2),
(104, 'Murder on sea', 3),
(105, 'The ABC Murders', 3);
7. Insert five members into the Members table.
→ INSERT INTO Members (member_id, membername)
VALUES
(201, 'John Doe'),
(202, 'Jane Smith'),
(203, 'Alice Johnson'),
(204, 'Bob Brown'),
(205, 'Charlie Davis');

8.Simulate a borrowing transaction by inserting records into the BorrowedBooks table.


Assume that three books have been borrowed by two different members.

→ INSERT INTO BorrowBooks (transaction_id, member_id, isbn, borrowdate,


returndate)
VALUES
(306, 201, 101, '2023-10-01', '2023-10-15'),
(307, 201, 102, '2023-10-05', '2023-10-20'),
(308, 202, 103, '2023-10-10', '2023-10-25');
8. Update the information for one of the authors in the Authors table.
→ UPDATE authors
set authorname='rohn john'
WHERE author_id =1;

9. Simulate a book return transaction by updating the ReturnDate in the BorrowedBooks


table for a selected book.
→ update borrowbooks
set returndate='2025-10-8'
WHERE transaction_id=306;

10. Delete one book from the Books table.


→ DELETE from books
where isbn=105;

You might also like