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

Computer (CD Management)

Uploaded by

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

Computer (CD Management)

Uploaded by

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

Emerald International School

Bairegowdanahalli, Sondekoppa Road, Nelamangala, Bengaluru Karnataka 562123


Affiliated to CBSE Curriculum School Code: 45969
Website: www.emeraldinternationalschool.co.in

A Project Report

on

CD Management System

for

SSCE 2024-2025 Examination

As a part of the Computer Science (083)

Submitted by: Harshit Prasad L K


Exam Roll No. :
Submitted by: Shourya Rathi
Exam Roll No. :
Submitted by: Rudrashish Chakravarthy
Exam Roll No. :

Under the Guidance of

Mr. Shankar Hakke


PGT- Computer Science / Informatics Practices
Emerald International School
Bairegowdanahalli, Sondekoppa Road, Nelamangala, Bengaluru Karnataka 562123
Affiliated to CBSE Curriculum School Code: 45969
Website: www.emeraldinternationalschool.co.in

CERTIFICATE

This is to certify that the Dissertation entitled, CD Management System is a bonafide work done

by Mr. Harshit Prasad of class XII Science during the academic session 2024-2025 in partial fulfillment of

CBSE's SSCE Examination 2025 and has been carried out under my direct supervision and guidance. This

report or a similar report on the topic has not been submitted for any other examination and does not form a

part of any other course undergone by the candidate.

______________ ________________

Signature of Internal Examiner Signature of External Examiner


Mr. Shankar Hakke

______________
Signature of Principal Seal of the School
DECLARATION

I hereby declare that this project entitled “CD Management System” undertaken at Emerald International

School is a comprehensive record of the project work submitted by me for the partial fulfillment of the

Secondary School Certificate Examination (SSCE) under the CBSE curriculum.

This project has been carried out under the guidance of Mr. Shankar Hakke (PGT-Computer Science /

Informatics Practices), whose constant support has been invaluable throughout the course of its development.

I affirm that the contents of this project are a product of my own original work and research and that it is not a

reproduction of any project work that has been previously done or submitted by any individual.

Mr. Harshit Prasad


Examination Roll No. -
ACKNOWLEDGEMENT

At the completion of this project, I would like to cordially extend my sincerest gratitude to Emerald

International School, which provided me with the necessary opportunities to fulfill my wishes and achieve my

goals.

I would like to express a deep debt to Mr. Shankar Hakke (PGT-Computer Science / Informatics Practices),

my project guide, for his vital suggestions, meticulous guidance and constant motivation, which went a long

way in the successful completion of this project.

I cannot move on without thanking my respected Principal for creating the required academic environment

which made my task appreciable.

On a more personal note, my deepest appreciation and gratitude go to my beloved parents, who have been an

inspiration and have provided me with unrelenting encouragement and support.

Ms. Harshit Prasad


Index

S. No. Heading Page Number

1. Overview of Python , SQL…………………………….……………5-6

2. About the project…………...…………………………….……………7

3. Source Code……………………...……………….………………..8-13

4. Outputs………………………….………………………..…….…14-19

5. Bibliography…………………………..…………………...…………20
Introduction to Python :
Python is a high-level, interpreted, and general-purpose programming language that was created by
Guido van Rossum and first released in 1991. Python has become one of the most popular
programming languages in the world due to its simplicity, readability, and versatility. It emphasizes
code readability with its use of indentation, making it an ideal language for beginners and
experienced developers alike. Python's syntax is clean, and its language constructs and object-
oriented approach aim to help developers write clear, logical code. Its dynamic typing and garbage
collection features make it an excellent choice for rapid development, prototyping, and a variety of
applications.

Applications of Python :
Python is a versatile programming language and is used in a wide range of fields and industries.
Below are some of the key areas where Python is commonly used
1. Web Development: Python is extensively used in web development. Frameworks like
Django, Flask, and Fast API make it easier to build scalable, secure, and efficient web
applications. Python also integrates well with front-end technologies and can be used to create
REST ful APIs and dynamic websites.

2. Automation and Scripting: Python is often used for automating repetitive tasks. You can
write scripts to automate file handling, email sending, web scraping, and data entry, saving
time and effort in tasks that would otherwise be manual.

3. Networking: Python is used to build networking applications, including chat servers, data
transfer tools, and remote communication software. Libraries such as socket and Twisted are
widely used for network programming.

4. Finance and Trading: Python is extensively used in the financial industry for quantitative
analysis, risk management, and algorithmic trading. Libraries like QuantLib, Pandas, and
PyAlgoTrade provide tools for working with financial data and creating trading strategies.

Introduction MySQL :
Introduction to SQL (Structured Query Language)
SQL (Structured Query Language) is a standard programming language used to manage and
manipulate relational databases. It is the backbone of most relational database management systems
(RDBMS), such as MySQL, PostgreSQL, Oracle, SQL Server, and SQLite. SQL allows users to
query, insert, update, delete, and manage data in a structured format within a database.
SQL is a declarative language, which means that users specify what data they want to work with, not
how to retrieve it. This makes it very user-friendly and highly effective for interacting with large
datasets.
SQL was initially developed in the early 1970s by Donald D. Chamberlin and Ray Boyce at IBM,
and it has since become the industry standard for relational databases.

Key Features :

1) Standardized: SQL is an ANSI and ISO standard language, which means that its core syntax and
functionality are consistent across most RDBMS.
2) Data Manipulation: SQL is designed to interact with structured data stored in relational tables.
It provides powerful commands for performing operations like:
 Insert , Update , Delete , Select
3) Data Definition: SQL allows users to define and modify database structures (schemas, tables,
indexes, etc.). This is done using Data Definition Language (DDL) commands like CREATE,
ALTER, and DROP.
4) Data Integrity: SQL provides features like primary keys, foreign keys, and constraints to ensure
that data remains consistent and valid.

About the Project


This project is a simple CD Management System built with Python, utilizing a MySQL database for
data storage. The system provides essential functionality for managing CDs spanning different
decades, specifically the 90s, 2000s, and 2010s .
This system utilizes a MySQL database to manage data, featuring three distinct tables for CDs from
the 1990s, 2000s, and 2010s. The program is menu-driven, ensuring it is user-friendly and easy to
navigate.

The CD Management System allows users to:


1. To add CD entry : New users can add new entry’s with each entry assigned a unique CD
ID. This involves getting a title and artist , verified to avoid duplicates and mismatches.
2. To view the CD ‘s : Registered users can access the details of thre records in the system
which are arranged in their respective order of their decade. Using unique ID assigned to every
record
3. Edit Existing Records: The system provides the capability to modify current records.
4. Delete Records: Users can eliminate CD records using their unique ID.
5. Organized by Decade: The database is structured into three tables for 90s Hits, 2000s Hits,
and 2010s Hits.
This system is designed to be a straightforward yet effective method for cataloguing and
managing a music collection, emphasizing both user-friendliness and data organization.

Source Code
import mysql.connector
print("""

*********************************************************
_______________________________________________________
| ========================================= |
| * DiscTracker * |
| ========================================= |
| Track Every Track, Relive Every Moment |
|_______________________________________________________|

*********************************************************

CD Management System

*********************************************************

""")

passwd = input("Enter Database Password: ")

try:
db = mysql.connector.connect(
host="localhost", user="root", passwd=passwd)

except:
print("Connection failed. Try again.")
exit()

cursor = db.cursor()

# Create Database and Tables

cursor.execute("CREATE DATABASE IF NOT EXISTS cd_management")


cursor.execute("USE cd_management")

tables = {
"hits_90s": """
CREATE TABLE IF NOT EXISTS hits_90s (
id INT PRIMARY KEY,
title VARCHAR(100) NOT NULL,
artist VARCHAR(100) NOT NULL,
year INT NOT NULL
)
""",
"hits_2000s": """
CREATE TABLE IF NOT EXISTS hits_2000s (
id INT PRIMARY KEY,
title VARCHAR(100) NOT NULL,
artist VARCHAR(100) NOT NULL,
year INT NOT NULL
)
""",
"hits_2010s": """
CREATE TABLE IF NOT EXISTS hits_2010s (
id INT PRIMARY KEY,
title VARCHAR(100) NOT NULL,
artist VARCHAR(100) NOT NULL,
year INT NOT NULL
)
"""
}

for table_name, query in tables.items():


cursor.execute(query)

db.commit()

# Insert Record into Table


def add_entry(cursor, db, table_name):

cursor.execute(f"select count(*) from {table_name}")


id = cursor.fetchone()[0] + 1
print(f"\n--- Add Entry to {table_name.replace('_', ' ').title()} ---")
title = input("Enter CD Title: ").strip()
artist = input("Enter Artist Name: ").strip()
year = input("Enter Year of Release: ").strip()

if not (title and artist and year.isdigit()):


print("Invalid input. Please enter all details correctly.\n")
return

query = f"INSERT INTO {table_name} VALUES (%s, %s, %s, %s)"


cursor.execute(query, (id, title, artist, int(year)))
db.commit()
print("Entry Added Successfully!\n")

# View Records from Table


def view_table(cursor, table_name):
print(f"\n--- Viewing {table_name.replace('_', ' ').title()} ---")
cursor.execute(f"SELECT * FROM {table_name}")
records = cursor.fetchall()

if records:
print(f"\n{'ID':<5} {'Title':<30} {'Artist':<30} {'Year':<10}")
print("-" * 75)
for row in records:
print(f"{row[0]:<5} {row[1]:<30} {row[2]:<30} {row[3]:<10}")
else:
print("No records found.\n")
return 0
def edit_record(cursor, db):
print("\n--- Edit Record ---")
print("1. Edit 90's Hits")
print("2. Edit 2000's Hits")
print("3. Edit 2010's Hits")

choice = input("Select the table to edit from (1-3): ").strip()

table_mapping = {
'1': 'hits_90s',
'2': 'hits_2000s',
'3': 'hits_2010s'
}

if choice not in table_mapping:


print("Invalid choice. Please try again.\n")
return

table_name = table_mapping[choice]

c = view_table(cursor, table_name)
if c == 0:
print("Nothing can be edited.")
return

record_id = input(f"\ncmgcmgEnter the ID of the record to edit from {table_name.replace('_', ' ').title()}:
").strip()

if not record_id.isdigit():
print("Invalid ID. Please enter a numeric value.\n")
return

# Check if record exists


cursor.execute(f"SELECT * FROM {table_name} WHERE id = %s", (record_id,))
record = cursor.fetchone()

if record:
print(f"\nCurrent details: Title: {record[1]}, Artist: {record[2]}, Year: {record[3]}")

title = input(f"Enter new title (current: {record[1]}): ").strip()


artist = input(f"Enter new artist (current: {record[2]}): ").strip()
year = input(f"Enter new year (current: {record[3]}): ").strip()

if not (title and artist and year.isdigit()):


print("Invalid input. Please enter all details correctly.\n")
return

# Update the record in the table


query = f"UPDATE {table_name} SET title = %s, artist = %s, year = %s WHERE id = %s"
cursor.execute(query, (title, artist, int(year), record_id))
db.commit()
print(f"Record ID {record_id} updated successfully in {table_name.replace('_', ' ').title()}.\n")
else:
print(f"Record ID {record_id} not found in {table_name.replace('_', ' ').title()}.\n")

def delete_record(cursor, db):


print("\n--- Delete Record ---")
print("1. Delete from 90's Hits")
print("2. Delete from 2000's Hits")
print("3. Delete from 2010's Hits")

choice = input("Select the table to delete from (1-3): ").strip()

table_mapping = {
'1': 'hits_90s',
'2': 'hits_2000s',
'3': 'hits_2010s'
}

if choice not in ['1', '2', '3']:


print("Invalid choice. Please try again.\n")
return

table_name = table_mapping[choice]

c = view_table(cursor, table_name)
if c == 0:
print("Nothing can be deleted.")
return

record_id = input(f"\nEnter the ID of the record to delete from {table_name.replace('_', ' ').title()}: ").strip()

if not record_id.isdigit():
print("Invalid ID. Please enter a numeric value.\n")
return

# Check if record exists


cursor.execute(f"SELECT * FROM {table_name} WHERE id = %s", (record_id,))
record = cursor.fetchone()

if record:
cursor.execute(f"DELETE FROM {table_name} WHERE id = %s", (record_id,))
db.commit()
print(f"Record ID {record_id} deleted successfully from {table_name.replace('_', ' ').title()}.\n")
else:
print(f"Record ID {record_id} not found in {table_name.replace('_', ' ').title()}.\n")

# Menu System
def menu(cursor, db):
while True:
print("\n====== DiscTracker ======")
print("1. Add Entry to 90's Hits")
print("2. Add Entry to 2000's Hits")
print("3. Add Entry to 2010's Hits")
print("4. View 90's Hits")
print("5. View 2000's Hits")
print("6. View 2010's Hits")
print("7. Edit a Record")
print("8. Delete a CD Record")
print("9. Exit")
print("10. Reset the Database")
print("=" * 40)

choice = input("Enter your choice (1-10): ").strip()

if choice == '1':
add_entry(cursor, db, 'hits_90s')
elif choice == '2':
add_entry(cursor, db, 'hits_2000s')
elif choice == '3':
add_entry(cursor, db, 'hits_2010s')
elif choice == '4':
view_table(cursor, 'hits_90s')
elif choice == '5':
view_table(cursor, 'hits_2000s')
elif choice == '6':
view_table(cursor, 'hits_2010s')
elif choice == '7':
edit_record(cursor, db)
elif choice == '8':
delete_record(cursor, db)
elif choice == '9':
print("Exiting Program... Goodbye!")
db.close()
break
elif choice == '10':
print("Database has been reset.")
cursor.execute("Drop database cd_management\n")
db.commit()
db.close()
break
else:
print("Invalid Choice. Please try again.\n")

menu(cursor, db)
Outputs
Output Screen – 1:
Greeting Screen

Output Screen – 2:
Main Interface

Output Screen-– 3:
Adding Record
Output Screen – 4:
Viewing the record

Output Screen – 5:
Adding another record

Output Screen – 6:
Viewing the record
Output Screen – 7:
Deleting a record

Output Screen – 8:
Updating a record
Output Screen – 9:
Viewing the updated record

Output Screen – 10:


Exiting the system

Output Screen –11:


Resetting the database
Output Screen – 12:
Database and Table Creation in MySQL

Output Screen – 13:


Data Added to Tables
Bibliography

Books:
1. ‘Computer Science with Python’ by NCERT
2. ‘Computer Science with Python’ by Sumita Arora
3. ‘My SQL for Python’ by Darryl E. Baily
4. ‘Learning Python’ by Mark Lutz

Websites/Videos:
1. www.google.com
2. www.geeksforgeeks.org/python-programming-language/
3. www.geeksforgeeks.org/python-mysql/
4. www.w3schools.com/python/
5. www.w3schools.com/mysql/
6. https://stackoverflow.com/

You might also like