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

Dbs Lab 4

The document describes two database design exercises completed by students. The first involves designing a database for a library inventory system to track book titles, descriptions, acquisition dates, locations, ISBNs, and conditions. The second requires designing a database for tracking special offers in a retail inventory system, including offer details, discount percentages, types, and categories. Tables are created with the appropriate fields and sample data is inserted to demonstrate functionality.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Dbs Lab 4

The document describes two database design exercises completed by students. The first involves designing a database for a library inventory system to track book titles, descriptions, acquisition dates, locations, ISBNs, and conditions. The second requires designing a database for tracking special offers in a retail inventory system, including offer details, discount percentages, types, and categories. Tables are created with the appropriate fields and sample data is inserted to demonstrate functionality.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Department of Computer Science HITEC University,

Taxila BS Computer Science Program (Batch 2021)

CS-304: Database Systems


Lab Folder
Fall 2023

Section B

Lab Report # 04
Muhammad Jahangir
21-cs-089
Basit Ali
21-cs-104
Muhammad Alrayan
21-cs-107
Instructor: Fatima Rauf
1 Design a database system for a library inventory system. The library recently received a
large collection of books and would like to keep better track of the titles. The library is still
using an antiquated method for the cataloging most its books. Because of your computer
skills, you have been asked to create a database.
Inserting Data

Result
Explanation:
1. We start by selecting the database library_system1 using the USE statement.
2. We create a table called books with the following columns:
• catalog_no (an integer) as the primary key.
• Title (a string with a maximum length of 30 characters).
• Description (a string with a maximum length of 30 characters).
• Aq_Date (date of acquisition, changed from 'Address' to 'Aq_Date').
• location (a string with a maximum length of 50 characters).
• ISBN (an integer).
• Condi (a string with a maximum length of 30 characters).
3. We insert sample data into the books table using the INSERT INTO statements, making
sure the column names in the INSERT statements match the columns in the table.
2 Design following database using SQL commands.

Creating Database
Creating Table

Result
Inserting Data into Table
Result

Explanation
1 We start by selecting the database inventory_system using the USE statement.
2 We create a table called shop with the following columns:
• Special_Offer_id (an integer) as the primary key with auto-increment, which
means it will automatically generate unique values.
• ETL_source (a string with a maximum length of 30 characters) for the source of
the data.
• Offer_name (a string with a maximum length of 50 characters) for the name of
the special offer.
• DiscountPct (a decimal number with 4 total digits and 2 decimal places) to store
the discount percentage.
• Type (a string with a maximum length of 50 characters) for the type of offer.
• Category (a string with a maximum length of 50 characters) for the category of
the offer.
3 We insert sample data into the shop table using INSERT INTO statements. This data
represents various special offers, their details, discount percentages, offer types, and
categories.

Conclusion
In conclusion, you've established a database to manage special offers in an inventory system.
This database allows you to store and track information about different types of special offers,
making it useful for managing promotions, discounts, and inventory-related activities in a retail
or sales environment.

You might also like