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 function called Boxed(ProductID)(Please do not change the signature pre-loaded in the answer box!)
Your function should do the following:
Query the database to retrieve data about the product whose Id is supplied as the ProductID parameter.
If the package field for the specific product contains the text "box" anywhere in its text, either as a whole word or a substring, the function should return the value True otherwise the function should return the value False.
You may assume only lowercase letters is used in the package field.
For example:
Test Result
print(Boxed(5))
True
print(Boxed(46))
False
EKS:
def Boxed(ProductID):
import sqlite3
conn = sqlite3.connect('Northwind2020.db')
#Your code goes here

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!