One option is to create an auto-increment column id, and then use it to create SKUfor each product as you insert it. The trigger that will be triggered after INSERTcan then be used to assign SKUto the newly inserted product. But, alas, MySQL does not allow a trigger to modify the table in which it was run.
. SKU SKUNXXXXX, XXXXX - , SKU " ", . , products :
CREATE TABLE products
(
id INT(11) NOT NULL AUTO_INCREMENT,
name VARCHAR(55),
...
);
, INSERT products, id MySQL. SKU, :
SELECT id, name, CONCAT('SKUN', id) AS `SKU`
FROM products
WHERE name = 'someproduct'
, SKU (.. , ), id, q.v. SO post .