A
A
Anton Shamanov2018-02-16 02:17:13
SQL
Anton Shamanov, 2018-02-16 02:17:13

Whether it is possible to make generated value of a field of sql request?

Does sql (or at least mysql > 5.4) allow to generate url field value? Something like that:

CREATE TABLE tbl (
       id INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
       ext VARCHAR(255) NOT NULL,
       url VARCHAR(255) NULL
);
INSERT INTO tbl (ext, url) VALUES ("jpg", CONCAT(id, ".", ext));

Interested in the syntax of such a construction.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question