1.

What is the use of Where Clause.Give a python statement Using the where clause?

Answer»

The WHERE clause is used to extract only .those records that fulfill a specified condition. In this example we are going to display the different grades scored by male students from “student table” import sqlite3

connection = sqlite3.connect(“Academy.db”)

cursor = connection.cursor( ) 

cursor.execute(“SELECT DISTINCT (Grade) FROM

student where gender= ’M'”)

result = cursor. fetchall( )

print(*result,sep= ”\n”)

OUTPUT

(‘B’ ,)

(‘A’ ,)

(‘C’ ,)

(‘D’ ,)



Discussion

No Comment Found