Computer Science

Identify the correct statement to create cursor:

import mysql.connector as msq
con = msq.connect()              #ConnectionString
mycursor = ...............
  1. con.cursor()
  2. con.create_cursor()
  3. con.open_cursor()
  4. con.get_cursor()

Python MySQL

2 Likes

Answer

con.cursor()

Reason — In MySQL connector for Python, the correct statement to create a cursor is con.cursor(). This method creates and returns a cursor object associated with the connection con, allowing to execute SQL queries.

Answered By

2 Likes


Related Questions