'SQL (MySQL etc), what is the difference about length string (1-256) and (0-256)?
Thanks for reading my post.
I wanna know, what is the difference between length (1-256) and (0-256) in sql and how to store them in database?. I was asked to design a db from the information below.
example case:
1. field : city, type : string, length (1-256)
2. field : email, type : string, length (0-256)
from my perspective:
1-256 = 256 character
0-256 = 257 character
Thanks a lot for any corrections or suggestions!
Regards, Denny
Solution 1:[1]
Apparently this is the information about the minimum and maximum possible length of some data.
Both will fit inside varchar(256) datatype. As for the minimum length (0 and 1) you can either ignore it or enforce it using check length(city) > 0 constraint as there is no such thing as varchar(1, 256) dataype.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
