Where is used to select data on condition in python

Pinterest LinkedIn Tumblr

Where is used to select data on condition. Now, we will select a record with name Siddharth.

SELECT column_name FROM table_name WHERE condition statement will be used to retrieve the data on some condition.

import mysql.connector as mysql

db = mysql.connect(
    passwd="[email protected]",

cursor = db.cursor()

## defining the Query
query = "SELECT * FROM user WHERE name = 'Siddharth'"

## getting records from the table

## fetching all records from the 'cursor' object
records = cursor.fetchall()

## Showing the data
for record in records:


  1. It is actually a great and useful piece of information. I am satisfied
    that you just shared this helpful information with us. Please stay us informed like this.
    Thanks for sharing.

  2. We’re a group of volunteers and opening a new scheme
    in our community. Your website provided us with valuable info to work on. You have performed a formidable activity and our entire community will probably be thankful to you.

Write A Comment