Avatar of karthik80c
karthik80c
Flag for United States of America

asked on 

Trigger in My SQL

I have a website where the Users enter the product information by Single entry or through the batch upload of CSV file. In both cases the records get inserted to the same table which is in My SQL database.
The information is then retrieved and shown in the website too.  There is a product id column which has 20 characters. But when we are displaying it in the website we show only the first 10 records. As the next 10 are critical and is not displayed. Though the product ID is a unique column the first 10 characters are not unique. So I will be attaching product id +0001 when the information is displayed outside. So I prefer to insert a column in the existing table. The column will get update with product id +0001 on the first entry. Whenever there is a duplicate record gets inserted in the product id by matching the first 10 characters the sequence should be predicted +0002.
So I need a trigger and sequence code in mysql for this. Please help.
MySQL ServerWeb Languages and Standards

Avatar of undefined
Last Comment
Phil Davidson

8/22/2022 - Mon