0
Hey, guys, what’s up? I have this case: I need to create a product table with the attributes 'id', 'Description', 'stock', 'unit', 'price' and 'local_photo', only I have doubts about the type of data to save the path of this photo. It would be a varchar supporting how many characters?
CREATE TABLE produto (
id INT AUTO_INCREMENT NOT NULL,
descricao VARCHAR (200) NOT NULL,
estoque INT (40) NOT NULL,
preco_venda FLOAT NOT NULL,
unidade CHAR(2) NOT NULL,
local_photo ??
);
it is better to keep the image path, and the size of the
varchar
will depend on where it is stored and the size of the image name.– ThRnk
A varchar of (100) will be good?
– Code Repeat
Have you searched the maximum path size that the OS image will be hosted supports? Most operating systems have something around 255, but you have to confirm, but deep down you need to know that. Where will the images be stored? which path? how is it
varchar
can put a larger than expected size that will not use, but the problem is even know how it will be stored, discover this and will get your answer :)– Ricardo Pontual
images can both have a name and
teste.png
as well asteste-implantado-na-empresa-fulana-20-19-2020-11-24-30.png
, still having to add the full path from where it is stored. everything depends on how your server is structured.– ThRnk
Varchar was created for this, you create with a size "good enough" and he only uses what he needs, his response depends on ...
– Motta
The maximum size a file name may have depends on the operating system and its version, and the file system used.
– José Diz