Free tutorials & notes in Hindi & English · Clean code examples 🧰 मुफ़्त PDF और फ़ोटो टूल्स →
🏆 Practical, Project और Viva  ·  Lesson 23

12 Projects: Python + MySQL

Project guidelines 2026-27

CBSE 2026-27 का CS project: Python file handling / Python-SQL connectivity से कुछ ठोस और उपयोगी बनाना – 2–3 students के group में, कम से कम 6 महीने पहले शुरू करके। Syllabus ख़ुद GST invoice जैसे project का उदाहरण देता है। नीचे 12 पूरे, tested projects हैं – हर एक MySQL connectivity, file handling, functions और exception handling इस्तेमाल करता है।

12 projects की list

#ProjectMySQL database
1School Fee Management Systemcs_fee_project
2Library Management Systemcs_library_project
3Hotel Room Booking Systemcs_hotel_project
4Bank Account Management Systemcs_bank_project
5Hospital Patient and Appointment Managementcs_hospital_project
6GST Billing and Invoice Systemcs_gst_project
7Bus Ticket Reservation Systemcs_bus_project
8Student Report Card Systemcs_reportcard_project
9Employee Payroll Systemcs_payroll_project
10Kirana Store Inventory Management Systemcs_inventory_project
11Computer Science Quiz Game with Leaderboardcs_quiz_project
12Electricity Billing Systemcs_electricity_project

हर project का विवरण

1. School Fee Management System

MySQL connectivityText fileCSV

School के students और monthly fee जमा का record MySQL में रखता है, fee receipt text file में बनाता है, किसी भी month के defaulters बताता है और fee register CSV में export करता है।

Menu: Add a student · Show all students · Collect fee & print receipt · Fee history of a student · Fee defaulters of a month · Class-wise collection · Export fee register (CSV)

Tables: student(adm_no, name, class, phone, monthly_fee); fee(receipt_no, adm_no, month, amount, paid_on)

Viva questions (answers के साथ)
  1. Why is AUTO_INCREMENT used for receipt_no?
    MySQL gives the next receipt number itself; cursor.lastrowid returns it after the INSERT.
  2. How are defaulters found?
    Admission numbers that paid for the month are put in a Python set; students not in this set are defaulters.
  3. Why is commit() needed after INSERT?
    Without commit() the change is not saved permanently in the database.
  4. Which file modes are used?
    "w" for the text receipt and the CSV register (newline="" for csv).
  5. Why are %s placeholders used instead of joining strings?
    The connector inserts values safely, avoiding errors with quotes and SQL injection.

2. Library Management System

MySQL connectivityCSVBinary (pickle)

School library की books और members संभालता है: issue/return और 14 दिन के बाद Rs 2 प्रति दिन fine, title/author से search, issued books की list, overdue report CSV में और catalogue का binary-file backup।

Menu: Add a book · Search books · Issue a book · Return a book · Books currently issued · Overdue report (CSV) · Backup catalogue (binary file)

Tables: book(book_id, title, author, category, copies); member(member_id, name, class); issue(issue_id, book_id, member_id, issue_date, return_date, fine)

Viva questions (answers के साथ)
  1. How is the fine calculated?
    Days kept minus 14 free days; if positive, multiplied by Rs 2. Date subtraction gives a timedelta whose .days is used.
  2. Why is return_date NULL for issued books?
    NULL means the book has not come back; IS NULL finds pending issues.
  3. Which join is used in "Books currently issued"?
    An equi-join of issue, book and member on book_id and member_id.
  4. How does pickle store the catalogue?
    pickle.dump() writes each dictionary to a binary file; pickle.load() reads them back until EOFError.
  5. Why is the copies column updated on issue and return?
    To keep stock correct: copies - 1 when issued, + 1 when returned.

3. Hotel Room Booking System

MySQL connectivityText fileCSV

छोटे hotel के check-in और check-out संभालता है: खाली rooms, room booking, check-out पर GST सहित bill (text file में), current guests और room-type-wise revenue।

Menu: Show free rooms · Check-in (book a room) · Check-out & bill · Current guests · Revenue by room type · Export bookings (CSV)

Tables: room(room_no, room_type, rate, status); booking(booking_id, guest, phone, room_no, check_in, check_out, amount)

Viva questions (answers के साथ)
  1. How is the number of nights calculated?
    check_out - check_in gives a timedelta; .days is the number of nights (minimum 1).
  2. Why is the room status updated?
    To show only free rooms for booking: Booked at check-in, Free again at check-out.
  3. What does IS NULL find in this project?
    Bookings whose check_out is still empty, i.e. guests staying in the hotel now.
  4. Where is the bill stored?
    In a text file output/bill_booking_<id>.txt opened in "w" mode.
  5. Which SQL clause gives revenue by room type?
    GROUP BY room_type with SUM(amount) on the joined tables.

4. Bank Account Management System

MySQL connectivityCSVStack

Savings/current accounts खोलता है, balance check के साथ deposit और withdrawal record करता है, mini statement दिखाता है, पूरा statement CSV में export करता है और session की recent activities का stack रखता है।

Menu: Open new account · Deposit · Withdraw · Mini statement (last 5) · Export statement (CSV) · Bank summary · Recent activity (stack)

Tables: account(acc_no, name, acc_type, balance, opened); txn(txn_id, acc_no, txn_date, kind, amount, balance_after)

Viva questions (answers के साथ)
  1. How is the minimum balance rule enforced?
    Before a withdrawal the new balance is checked; if it is below Rs 1000 a ValueError is raised and handled in except.
  2. Why are two tables used?
    account stores the current balance; txn stores every deposit/withdrawal for the statement.
  3. How is the recent activity a stack?
    Each action is appended (push) to a list and displayed in reverse, so the latest is on top.
  4. What does IFNULL(MAX(acc_no), 5000) + 1 do?
    Gives the next account number; if the table is empty MAX is NULL, so 5000 is used.
  5. Why does the statement export use newline=""?
    The csv module needs it to avoid blank lines between rows on Windows.

5. Hospital Patient और Appointment Management

MySQL connectivityText fileCSV

Patients register करता है, doctors के साथ OPD appointment बुक करता है, OPD slip text file में बनाता है, किसी दिन की appointment list, visit complete और doctor-wise patients व fee collection बताता है।

Menu: Register patient · Show doctors · Book appointment & OPD slip · Appointment list of a day (CSV) · Mark appointment visited · Doctor-wise report

Tables: doctor(doc_id, name, dept, fee); patient(pid, name, age, gender, phone); appointment(app_id, pid, doc_id, app_date, token, status)

Viva questions (answers के साथ)
  1. How is the token number decided?
    COUNT(*) of the doctor's appointments on that date plus 1.
  2. Which three tables are joined for the day list?
    appointment, patient and doctor using pid and doc_id (equi-join).
  3. What does cur.rowcount tell after UPDATE?
    How many rows were changed; 1 means the appointment was found and updated.
  4. Why is AUTO_INCREMENT used for pid?
    MySQL gives a unique patient id automatically; lastrowid returns it.
  5. Which files does the project create?
    A text OPD slip for every appointment and a CSV list for each day.

6. GST Billing और Invoice System

MySQL connectivityText fileCSV

CBSE syllabus में सुझाया गया project: दुकान का billing system जो products और उनकी GST rates रखता है, कई items वाले invoice CGST/SGST के साथ बनाता है, हर invoice text file में save करता है और return filing के लिए tax rate-wise GST summary देता है।

Menu: Show products · Add product · Create invoice · View all invoices · GST summary by rate (CSV) · Category-wise sales

Tables: product(code, name, category, price, gst_rate); invoice(inv_no, customer, inv_date, taxable, gst, total); invoice_item(inv_no, code, qty, price, gst_rate)

Viva questions (answers के साथ)
  1. How is GST calculated for an item?
    quantity x price x GST rate / 100; the invoice adds it for all items.
  2. Why is GST split into CGST and SGST?
    For a sale within the same state, half of GST goes to the Centre (CGST) and half to the State (SGST).
  3. Why is invoice_item a separate table?
    One invoice can have many items; storing items separately avoids repeating invoice details.
  4. Which query groups transactions by tax rate?
    SELECT gst_rate, SUM(qty*price), SUM(qty*price*gst_rate/100) FROM invoice_item GROUP BY gst_rate.
  5. How is the invoice number generated?
    IFNULL(MAX(inv_no), 0) + 1 gives the next number.

7. Bus Ticket Reservation System

MySQL connectivityText fileCSVStack

Khurja से routes के bus tickets बुक करता है, चुनी तारीख़ के लिए अगली खाली seat देता है, e-ticket text file में बनाता है, 80% refund के साथ ticket cancel करता है (cancelled PNR stack में), passenger list और route-wise collection दिखाता है।

Menu: Show buses · Seat availability · Book ticket · Cancel ticket · Cancelled in this session (stack) · Passenger chart (CSV) · Route-wise collection

Tables: bus(bus_no, route, departure, seats, fare); ticket(pnr, bus_no, passenger, age, seat_no, travel_date, status)

Viva questions (answers के साथ)
  1. How is the seat number allotted?
    Booked seats for the bus and date are collected in a set; the first seat number not in the set is given.
  2. Why is a ticket not deleted on cancellation?
    Its status is changed to Cancelled so that the record and refund history remain.
  3. Where is the stack used?
    Cancelled PNRs are pushed with append(); they are shown in reverse so the latest is on top.
  4. Which query calculates route-wise collection?
    A join of ticket and bus with GROUP BY route and SUM(fare) for booked tickets.
  5. What happens if the same PNR is cancelled twice?
    The SELECT finds no booked ticket, so a message is shown and nothing changes.

8. Student Report Card System

MySQL connectivityText fileCSVBinary (pickle)

Students और पाँच subjects के theory व practical marks रखता है, grades के साथ report card text file में बनाता है, class toppers और subject averages निकालता है और सभी report cards binary file में save करता है।

Menu: Add student with marks · Re-enter marks of a student · Print report card · Class toppers · Subject-wise average · Archive all cards (binary + CSV)

Tables: student(roll, name, class); marks(roll, subject, theory, practical)

Viva questions (answers के साथ)
  1. Why does the marks table have a composite primary key?
    (roll, subject) together is unique: one student has one row per subject.
  2. How is the grade decided?
    The function grade() checks the total against limits 91, 81, 71 ... and returns A1, A2, B1 ...
  3. Which SQL finds the class topper?
    SUM(theory + practical) grouped by student and ordered in descending order of total.
  4. What is stored in the binary file?
    One dictionary per student (report card) written with pickle.dump().
  5. How is invalid input handled?
    read_int() repeats on ValueError, and the marks loop repeats until marks are in range.

9. Employee Payroll System

MySQL connectivityText fileCSV

किसी संस्था के employees रखता है और DA, HRA व PF कटौती के साथ monthly pay slips text file में बनाता है, department-wise salary bill, increment और payroll register CSV export करता है।

Menu: Add employee · List employees · Generate pay slips for a month · Department-wise salary bill · Give increment · Export payroll register (CSV)

Tables: employee(emp_id, name, designation, dept, basic, join_date); payslip(slip_id, emp_id, month, basic, da, hra, pf, net)

Viva questions (answers के साथ)
  1. How is net salary calculated?
    Basic + DA (50%) + HRA (20%) - PF (12% of basic + DA).
  2. How does the program stop duplicate pay slips?
    It counts rows of that month in payslip; if more than zero it does not generate again.
  3. Which SQL gives the department-wise bill?
    Join of employee and payslip with GROUP BY dept and SUM of gross, PF and net.
  4. How is an increment applied to one department?
    UPDATE employee SET basic = ROUND(basic * (1 + pct/100)) WHERE dept = %s.
  5. Why is each pay slip a separate text file?
    So it can be printed or mailed to that employee; the file name has month and employee id.

10. Kirana Store Inventory Management System

MySQL connectivityCSVBinary (pickle)

Kirana दुकान का stock रखता है: purchase (stock in) और sale (stock out) entries log के साथ, negative stock रोकता है, low-stock alert देकर reorder list CSV में बनाता है और category-wise stock value व expected profit दिखाता है।

Menu: Show stock · Add new item · Purchase (stock in) · Sale (stock out) · Reorder list (CSV) · Category-wise stock value · Stock movement log · Save stock snapshot (binary)

Tables: item(code, name, category, qty, reorder_level, cost, mrp); stock_log(log_id, code, log_date, kind, qty)

Viva questions (answers के साथ)
  1. How is negative stock prevented?
    Before a sale the requested quantity is compared with qty in stock; if larger, the sale is refused.
  2. What is the reorder level?
    A minimum quantity; when stock falls to it or below, the item appears in the reorder list.
  3. How is the order quantity decided?
    Enough to bring the stock up to twice the reorder level: 2 x level - stock.
  4. Why keep a separate stock_log table?
    It records every purchase and sale with date, so stock changes can be checked later.
  5. Which SQL gives category-wise stock value?
    SELECT category, SUM(qty*cost) ... GROUP BY category.

11. Computer Science Quiz Game with Leaderboard

MySQL connectivityCSVStackrandom

Menu-driven quiz game: questions MySQL में रखे हैं (CSV file से import भी हो सकते हैं), topic-wise random questions पूछे जाते हैं, गलत जवाब review stack में जाते हैं, score save होते हैं और leaderboard व topic-wise average दिखता है।

Menu: Play quiz · Add a question · Import questions from CSV · Leaderboard (CSV) · Topic-wise statistics

Tables: question(qid, topic, question, opt_a, opt_b, opt_c, opt_d, answer); score(sid, player, topic, score, total, played_on)

Viva questions (answers के साथ)
  1. How are questions chosen randomly?
    random.sample(pool, n) picks n different questions from the topic.
  2. How is the stack used?
    Every wrongly answered question is pushed; after the quiz they are popped and shown for revision.
  3. How does CSV import avoid duplicates?
    Before inserting, it checks with COUNT(*) whether the same question text already exists.
  4. How is the leaderboard ordered?
    By percentage score in descending order, then by date.
  5. What does zip("abcd", options) do?
    It pairs each letter with its option so they can be printed together.

12. Electricity Billing System

MySQL connectivityText fileCSV

Domestic और commercial consumers register करता है, monthly meter reading लेता है, fixed charge के साथ slab-wise bill बनाता है (text file में), payment लेता है, unpaid bills और month-wise collection दिखाता है।

Menu: Register consumer · Enter reading & generate bill · Pay bill · Unpaid bills (CSV) · Month-wise collection

Tables: consumer(cons_no, name, address, category, meter_no); reading(read_id, cons_no, month, prev_reading, curr_reading, units, amount, paid)

Viva questions (answers के साथ)
  1. How is a slab-wise bill calculated?
    Units in each slab are multiplied by that slab's rate and added; then the fixed charge is added.
  2. Where does the previous reading come from?
    From the last reading row of that consumer (ORDER BY read_id DESC LIMIT 1); 0 for a new consumer.
  3. How does the program check a wrong reading?
    If the current reading is less than the previous one, the bill is not generated.
  4. Which query gives month-wise collection?
    GROUP BY month with SUM(amount) and a CASE expression to add only paid bills.
  5. Why is paid stored as Y/N?
    It is a simple flag to find unpaid bills (paid = 'N') and mark them paid with UPDATE.

Project कैसे चलाएँ

Shell
pip install mysql-connector-python
# open main.py and write your MySQL password in MYSQL_PASSWORD
python main.py

Database, tables और sample data पहली बार चलाने पर अपने आप बन जाते हैं। हर folder में README.md, database.sql और असली sample_output.txt है।

Project file का format

  1. Cover page
  2. Certificate
  3. Acknowledgement
  4. Index
  5. Introduction (real problem chosen)
  6. Objectives
  7. Hardware & software requirements
  8. Concepts used
  9. Database design (tables)
  10. Source code
  11. Output screenshots
  12. Limitations & future scope
  13. Bibliography / references
पूरे marks के लिए

Sample data को अपने school, शहर या किसी local दुकान (अनुमति लेकर) के data से बदलें, कम से कम एक feature अपना जोड़ें, और हर data source का reference लिखें।

अक्सर पूछे जाने वाले प्रश्न (FAQ)

2026-27 में Class 12 CS project में क्या ज़रूरी है?
किसी असली problem के लिए Python file handling और/या Python-SQL connectivity; ये projects दोनों इस्तेमाल करते हैं।
क्या database ख़ुद बनाना होगा?
नहीं। main.py database, tables और sample records अपने आप बनाता है; database.sql optional है।
← Class 12 Computer Science
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

अगला topicज़रूरी Questions और Viva आपकी प्रगति: 23 / 24 (96%) · Lesson 24 / 24 आगे बढ़ें →

यह lesson कैसा लगा?

आपकी राय से हम content और बेहतर बनाते हैं।

अपना review और सुझाव लिखें (वैकल्पिक)

Review approve होने के बाद आपका नाम और शहर इसके साथ public दिख सकते हैं। Email या phone न लिखें।

▶ CodingEasily on YouTube

Video से सीखें – आसान Hindi में

चुनी हुई video: RDBMS भाग 3 – Class XI Commerce IT

▶ Channel subscribe करें