Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions

Question

L04 Assess the biological contributions to sexual orientation.

Answered: 1 week ago