SQL78. 检索产品名称和描述(四)
描述
prod_name | prod_desc |
a0011 | usb |
a0019 | iphone13 |
b0019 | gucci t-shirts |
c0019 | gucci toy |
d0019 | lego toy carrots |
prod_name | prod_desc |
d0019 | lego toy carrots |
示例1
输入:
DROP TABLE IF EXISTS `Products`; CREATE TABLE IF NOT EXISTS `Products` ( `prod_name` VARCHAR(255) NOT NULL COMMENT '产品 ID', `prod_desc` VARCHAR(255) NOT NULL COMMENT '产品名称' ); INSERT INTO `Products` VALUES ('a0011','usb'), ('a0019','iphone13'), ('b0019','gucci t-shirts'), ('c0019','gucci toy'), ('d0019','lego toy carrots ');
输出:
d0019|lego toy carrots
Mysql 解法, 执行用时: 38ms, 内存消耗: 6496KB, 提交时间: 2022-03-03
select prod_name,prod_desc from Products where prod_desc LIKE "%toy%carrots%";
Mysql 解法, 执行用时: 38ms, 内存消耗: 6500KB, 提交时间: 2022-03-02
select prod_name,prod_desc from Products where prod_desc like "%toy%carrots%"
Mysql 解法, 执行用时: 39ms, 内存消耗: 6444KB, 提交时间: 2022-03-03
select prod_name,prod_desc from Products where prod_desc like '%toy%carrots%'
Mysql 解法, 执行用时: 39ms, 内存消耗: 6452KB, 提交时间: 2022-03-04
select prod_name ,prod_desc from Products where prod_desc like '%toy%carrots%'
Mysql 解法, 执行用时: 39ms, 内存消耗: 6532KB, 提交时间: 2022-03-03
select prod_name, prod_desc from Products where prod_desc like "%toy%carrots%"