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

Class 11 IP Project Python SQL

Hi

Uploaded by

veerukumar8026
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
177 views

Class 11 IP Project Python SQL

Hi

Uploaded by

veerukumar8026
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

IP Project for Class 11: Python + SQL

This document outlines an IP Project for Class 11 students integrating Python and SQL. The project

aims to demonstrate CRUD operations using Python as the frontend and SQL as the backend

database.

Objectives
- Understand how to integrate Python with SQL.

- Perform CRUD (Create, Read, Update, Delete) operations.

- Develop problem-solving and coding skills.

Requirements
- Python 3.x

- MySQL Server

- MySQL Connector for Python

Project Outline
1. **Database Design:**

- Create a database named `school`.

- Design a table `students` with the following fields:

- `id` (INT, Primary Key, Auto Increment)

- `name` (VARCHAR(50))

- `age` (INT)

- `class` (VARCHAR(10))

2. **Python Code:**

- Connect to the MySQL database using MySQL Connector.

- Implement CRUD operations:


- Insert new student records.

- Fetch and display all student records.

- Update a student's details.

- Delete a student's record.

3. **Execution:**

- Run the Python script and perform operations.

Sample Code
import mysql.connector

# Connect to MySQL Database

conn = mysql.connector.connect(

host="localhost",

user="root",

password="password",

database="school"

cursor = conn.cursor()

# Insert Data

cursor.execute("INSERT INTO students (name, age, class) VALUES (%s, %s, %s)", ('John

Doe', 15, '10A'))

conn.commit()

# Fetch Data

cursor.execute("SELECT * FROM students")


for row in cursor.fetchall():

print(row)

conn.close()

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy