Dbs Lab 4
Dbs Lab 4
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.