Question: A query of the table information for table Supplier returns the following information: cid name type notnull dflt _ value pk 0 Id INTEGER 0

A query of the table information for table Supplier returns the following information:
cid name type notnull dflt_value pk
0 Id INTEGER 0 None 1
1 CompanyName TEXT 1 None 0
2 ContactName TEXT 0 None 0
3 ContactTitle TEXT 0 None 0
4 City TEXT 0 None 0
5 Country TEXT 0 None 0
6 Phone TEXT 0 None 0
7 Fax TEXT 0 None 0
A query of the table information for table Customer returns the following information:
cid name type notnull dflt_value pk
0 Id INTEGER 0 None 1
1 FirstName TEXT 1 None 0
2 LastName TEXT 1 None 0
3 City TEXT 0 None 0
4 Country TEXT 0 None 0
5 Phone TEXT 0 None 0
A query of the table information for table Product returns the following information:
cid name type notnull dflt_value pk
0 Id INTEGER 0 None 1
1 ProductName TEXT 1 None 0
2 SupplierId INTEGER 1 None 0
3 UnitPrice REAL 100
4 Package TEXT 0 None 0
5 IsDiscontinued INTEGER 100
A query of the table information for table Order returns the following information:
cid name type notnull dflt_value pk
0 Id INTEGER 0 None 1
1 OrderDate TEXT 1 None 0
2 OrderNumber TEXT 0 None 0
3 CustomerId INTEGER 1 None 0
4 TotalAmount REAL 000
A query of the table information for table OrderItem returns the following information:
cid name type notnull dflt_value pk
0 Id INTEGER 0 None 1
1 OrderId INTEGER 1 None 0
2 ProductId INTEGER 1 None 0
3 UnitPrice REAL 100
4 Quantity INTEGER 110
Your Task
Write a procedure called CustomerLookup(Surname)(Please do not change the signature pre-loaded in the answer box!)
Your procedure should do the following:
For the given Surname you should query the database and retrieve any Customers where the customer LastName (or part of it) matches the surname given as parameter. (Please note that the case of the input ("SMITH" vs "smith" vs "Smith") will not matter if the correct SQL statement is used. You can completely ignore case and just focus on using the correct SQL in your WHERE clause. )
Print a line stating "All possible matches")"
Print the data for each matching record found one line at a time using the format
'Name: FirstName Surname: LastName Phone: Phone'
Please see examples below:
For example:
Test Result
CustomerLookup('Soap')
All possible matches
CustomerLookup('riot')
All possible matches
FirstName: Pdef CustomerLookup(Surname):
import sqlite3
conn = sqlite3.connect('Northwind2020.db')
# Your code goes here
cursor = conn.cursor()aul LastName: Henriot Phone: 26.47.15.10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!