Length Function - How to get Data of String in Bytes in MySQL
Length function is used to return the size of string in Bytes in MySQL. It is equivalent to DataLength( ) Function in SQL Server.
Syntax:
Select Length('StringValue');
Let's say we have customer table with some records and we would like to get the data length for firstname and lastname values.
CREATE TABLE `customer` (
`idcustomer` int,
`firstname` varchar(50) NULL,
`lastname` varchar(30) NULL,
`age` int(11) DEFAULT NULL,
`phonenumber` char(11) DEFAULT NULL,
`dob` date DEFAULT NULL,
`gender` char(1) NOT NULL
) ;
-- Insert sample records
insert into customer(idcustomer,firstname,lastname,age,phonenumber,dob,gender)
values
(1,'Raza',null,39,'505-4141969','1980-01-01','M'),
(2,'Aamir','Naz',39,'505-4141969','1980-01-01','M'),
(3,'Aamir','Shahzad',39,'505-4141900','1980-01-01','M'),
(4,'Aamir1','Shahzad',39,'505-4141900','1980-01-01','M'),
(5,'Robert','Ladson',69,'505-345900','1960-01-01','M');
use Length( ) function to get the size of column values in Bytes.
Select firstname,length(firstname), lastname,length(lastname),phonenumber,length(phonenumber) from customer;
CREATE TABLE `customer` (
`idcustomer` int,
`firstname` varchar(50) NULL,
`lastname` varchar(30) NULL,
`age` int(11) DEFAULT NULL,
`phonenumber` char(11) DEFAULT NULL,
`dob` date DEFAULT NULL,
`gender` char(1) NOT NULL
) ;
-- Insert sample records
insert into customer(idcustomer,firstname,lastname,age,phonenumber,dob,gender)
values
(1,'Raza',null,39,'505-4141969','1980-01-01','M'),
(2,'Aamir','Naz',39,'505-4141969','1980-01-01','M'),
(3,'Aamir','Shahzad',39,'505-4141900','1980-01-01','M'),
(4,'Aamir1','Shahzad',39,'505-4141900','1980-01-01','M'),
(5,'Robert','Ladson',69,'505-345900','1960-01-01','M');
use Length( ) function to get the size of column values in Bytes.
Select firstname,length(firstname), lastname,length(lastname),phonenumber,length(phonenumber) from customer;
How to get size of Column in MySQL by using Length ( ) Function - MyQL Tutorial
Very creative post, truly this is a very good job. Your explanation is very superb and I appreciate your great efforts. I like a more valuable post from your blog...
ReplyDeleteTableau Training in Chennai
Tableau Course in Chennai
Pega Training in Chennai
Excel Training in Chennai
Power BI Training in Chennai
Primavera Training in Chennai
Unix Training in Chennai
Tableau Training in Chennai
Tableau Course in Chennai
IEEE Final Year Project centers make amazing deep learning final year projects ideas for final year students Final Year Projects for CSE to training and develop their deep learning experience and talents.
DeleteIEEE Final Year projects Project Centers in India are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation.
corporate training in chennai corporate training in chennai
corporate training companies in india corporate training companies in india
corporate training companies in chennai corporate training companies in chennai
I have read your blog its very attractive and impressive. I like it your blog. Digital Marketing Company in Chennai Project Centers in Chennai
Good blog, its really very informative, do more blog under good concepts.
ReplyDeleteDOT NET Training in Bangalore
DOT NET Training in Chennai
DOT NET Training Institutes in Bangalore
DOT NET Course in Bangalore
Best DOT NET Training Institutes in Bangalore
DOT NET Institute in Bangalore
AWS Training in Bangalore
Data Science Courses in Bangalore
DevOps Training in Bangalore
PHP Training in Bangalore
I have to agree with everything in this post. Thanks for useful sharing information.
ReplyDeleteHadoop Training in Chennai
Hadoop Training in Bangalore
Big Data Course in Coimbatore
Big data course in bangalore
Big Data Hadoop Training in Bangalore
Big Data Training in Bangalore
Python Training in Bangalore
salesforce training in bangalore
hadoop training in marathahalli
hadoop training in btm
Great information. The above content is very interesting to read. This will be loved by all age groups.
ReplyDeletewhich cloud computing certification is best
robotic process automation scope
best digital marketing certification
hadoop interview questions and answers for experienced
Awesome article!!! Eagerly waiting for your new article... thanks for sharing with us.
ReplyDeleteadvantages of seo
how to improve english pronunciation
web design using html
automation testing tools
salesforce interview questions for freshers
salesforce developer interview questions and answers
Great post. keep sharing such a worthy information
ReplyDeletecyber security course in bangalore
cyber security training in chennai
Fabulous post... Keep sharing
ReplyDeleteBest English Coaching Courses in Chennai
Spoken English Courses in Chennai
Great post. keep sharing such a worthy information
ReplyDeletecyber security course in bangalore
cyber security training in chennai
Great post. keep sharing such a worthy information
ReplyDeleteswift training in bangalore
swift developer training in chennai
Amazing blog...keep sharing
ReplyDeleteIELTS Training in Chennai
IELTS Classes in Chennai
IELTS Coaching in Chennai
IELTS Coaching centre in Chennai
Great post. keep sharing such a worthy information
ReplyDeletecyber security course in bangalore
cyber security training in chennai
Wonderful Blog.. keep updating
ReplyDeleteAWS Training in Chennai
Amazon web services Training in Chennai
AWS Training Institutes in Bangalore
AWS Certification Training in Bangalore
Such a great blog.Thanks for sharing useful information......
ReplyDeleteBest ios training in bangalore
Best ios training institute in bangalore