Search⌘ K
AI Features

Question: Conditional Logic and Loops

Explore how to write a stored routine that uses loops and conditional logic to evaluate suppliers' performance metrics. Learn to handle variables and control flow within routines to classify and insert results without modifying base tables.

Question

Given the following structure of the Suppliers table:

Field

Type

SupplierID

int

SupplierName

varchar(50)

Email

varchar(50)

Phone

varchar(15)

Address

varchar(100)

OnTimeDeliveryRate

decimal(5,2)

AvgLeadTime

int

Where, SupplierID is the primary key. The table contains information about suppliers of products.

The operations team needs a weekly supplier health snapshot for ...