mysql> use lr20;
Database changed
mysql> create table product (
-> id_product int primary key auto_increment,
-> name_product varchar(100) not null,
-> price decimal(10, 2) not null
-> );\
Query OK, 0 rows affected (0.03 sec)
mysql> delimiter //
mysql> create function category_product (price decimal(10,2))
-> returns varchar(50)
-> deterministic
-> begin
-> return
-> case
-> when price > 200.00 then 'category_C'
-> when price < 200.00 then 'category_A'
-> else 'category_B'
-> end;
-> end//
Query OK, 0 rows affected (0.24 sec)
mysql> insert into (name_product, price) values
-> ('sugar', 105.50);
-> //
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(name_product, price) values
('sugar', 105.50)' at line 1
mysql> delimiter ;
mysql> insert into (name_product, price) values
-> ('sugar', 105.50);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(name_product, price) values
('sugar', 105.50)' at line 1
mysql> insert into (name_product, price) values
-> ('sugar', '105.50');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(name_product, price) values
('sugar', '105.50')' at line 1
mysql>