Question

Attempt the following

I) Write Program to perform following tasks

a. Create a database SELECTION DB

b. Set connection with mysql.connector.connect.

с. Create a table STUDENT SELECTION in database SELECTION DB with following data FIRST NAME LAST NAME,AGE,GENDER, SCORE.

d. change table structure / (add, edit, remove column of a table) at run time

i. add a column address in the STUDENT SELECTIONtable.

ii. execute SQL INSERT statement to create a record into STUDENT SELECTION table

iii. run the query to updates all the records having GENDER as 'M', and increase AGE of all the males by one year.

iv. delete all the records from STUDENT_SELECTION Table where AGE is less than 18.

12 Feb 2025
Answer :
Word Count : 438

Here is how you can implement the tasks in Python using MySQL and MySQL connector:

### Step-by-step solution for the tasks:

1. a. Create a database SELECTION DB:

```python
import mysql.connector

# Establish connection to MySQL server
connection = mysql.connector.connect(
    host="localhost",
    user="your_username",
    password="your_password"
)

cursor = connection.cursor()

# Create database SELECTION_DB
cursor.execute("CREATE DATABASE IF NOT EXISTS SELECTION_DB")
print("Database 'SELECTION_DB' created successfully!")
```

2. b. Set connection with `mysql.connector.connect`:

```python
# Connect to the SELECTION_DB database
connection = mysql.connector.connect(
    host="localhost",
    user="your_username",
    password="your_password",
    database="SELECTION_DB"
)
cursor = connection.cursor()
```

3. c. Create a table STUDENT_SELECTION in database

__________ _____ _____ ______ ____ _________ ______ ___ __________.
_________ _________ ________ _________ __________ _____ _________.
_______ _____ ________ ____ ________ ______ ________ __________.
_________ _________ _______ ______ ______ _________ ________ ________ __________.
__________ _____ _______ _______ ______ __________ ________.
_________ _______ ________ _______ _________.
__________ ______ ____ _________ _______ __________.
________ ________ ________ _________ ____ ____ _________ _________.
______ _____ _________ _________ _______ _____ ___.
______ _______ _________ ___ ____ ____ ________.
_____ ________ _________ _______ __________ _______ _______ __________ ______.
_____ __________ _____ _____ ______ ______.
___ __________ ________ _____ ____.
_________ _______ _______ ______ _____ __________ ___ _______ _____ __________ _________.
___ ________ ____ __________ _______ _____ __________ _______ ______ ____ _______.
_________ __________ ______ ______ _____ ___ ________ _________ _____ ___.
_____ __________ ________ _______ __________ ____ __________ __________ ________ ____ _______.
_____ ____ ______ ________ _____.
_______ __________ ___ ____ ________ __________ ________ ____ _____ _________ ______.
____ ___ ________ _______ _______ ______ __________ ____.
________ _____ ____ ____ _______ ________.
_________ _________ _________ ________ ________ ___ __________ ________.
____ ________ ____ _________ _____ ________ ________ _____ ___ ___ ______ _____.
________ ________ ___ ___ ________ _______ ____ _________ _________ ______ ___.
___ ______ _________ ______ __________ ___ __________ ___ ________ ________ __________.
______ _________ __________ __________ ______ ______ ____.
______ ____ ____ ________ __________ _________ _________ _________ _________ ____ _________ _____.
_______ ____ ______ ________ _____ ___ _________ _____ _________.
_____ _____ ________ ___ _____ __________ ___ _______ ___ ____ ___.
_________ _________ _________ ___ ___ ____ _______ _____.
_______ __________ __________ __________ __________ ________ _______ _____ _______ ________.
_____ _______ ___ __________ ________ ____.
______ ___ ___ ____ _________ ___ ________ _____.
__________ ______ _____ _____ ___ ________ ______ _________.
_____ _________ _______ ____ _____ ____ ____ ____ _____ _________ ________.
______ __________ ______ ____ ______ _____ __________ _____ ____.
____ ________ ________ ______.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU MCSL 205 2025 - Attempt the followingI) Write Program to perform following tasks | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→