SQL Modify Product Names
SQL
Download (.zip)
/* This script will modify the product names in the Northwind database * After running this script, many products will now contain the words: * spicy, hot, and supreme. It make full-text searching on this table * a little bit more interesting.
* Written by Kalen Delaney */
use northwind ALTER TABLE products ALTER COLUMN productName nvarchar(120)
update products set productName = 'Hot and Spicy ' + productName where productId % 5 = 0
select * from products where productId % 5 = 0
update products set productName = 'Spicy Hot ' + productName where productId % 5 != 0 and productid % 7 = 0
select * from products where productId % 5 != 0 and productid % 7 = 0
update products set productName = productName + ' Supreme' where productId % 3 = 0
select * from products where productId % 3 = 0
update products set productName = productName + ' Extra Spicy' where productId % 9 = 0 and productId % 5 != 0 and productid % 7 != 0
select * from products where productId % 9 = 0 and productId % 5 != 0 and productid % 7 != 0
update products set productName = 'Supreme ' + productName where productId % 3 != 0 and productid % 4 = 0
select * from products where productId % 3 != 0 and productid % 4 = 0
|