Last answered:

12 Feb 2024

Posted on:

26 Jan 2024

0

VARCHAR QUESTION

When writing queries how do you know what number goes with the query

for example) VARCHAR(50) How do we determine what number goes into that parenthesis?

1 answers ( 0 marked as helpful)
Instructor
Posted on:

12 Feb 2024

0

Hi Shaterra!
Thanks for reaching out.


The number in parentheses after VARCHAR specifies the maximum number of characters allowed in that field. To determine what number to use, consider the data you expect to store. When using VARCHAR(50), it means any string up to 50 characters can be stored. If you expect a column to contain names, VARCHAR(50) might be sufficient. If it's for descriptions, you might need more, like VARCHAR(255). Always choose a length that fits well with the column description. Using VARCHAR(255) could be sufficient for most of the tables.



Hope this helps.
Best,
Tsvetelin

Submit an answer