In a table created with query:
CREATE TABLE t (t1 varchar(20), t2 char(20))
the following record was inserted:
INSERT INTO t VALUES('test', 'test')
What will the following query return?
SELECT length(t1) t1, length(t2) t2 FROM t
Explanation
Value of a char type will always have a lenght that was specified at table's creation. At the same time varchar length will be always equal to the length of the string that is actually stored.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes