How do i fix 'data too long for column' in sql?

Example:

INSERT INTO users (name) VALUES ('A very long name that exceeds the column's capacity');

The data you're inserting is too long for the column's defined capacity.

Solution:

Either truncate the data to fit within the column's limits or alter the table to increase the column's capacity.


-- Adjusting the column size:
ALTER TABLE users MODIFY name VARCHAR(255);
-- Or truncating the input:
INSERT INTO users (name) VALUES ('Truncated Name');

Beginner's Guide to SQL