Varchar Data Type in Mysql , Mysql Tutorial

We have been using only integer type values 'int'

What if we want to enter names or strings ????

We will use 'varchar(30)'

Just keep in mind we will put 'varchar(30)' instaed of

'int' and will put the value in quotes (')

For example ::::::

We will make a new table say 'student'

With 2 columns 'name' & 'marks'

 > create table student (name varchar (20) , marks int) ;


We can now insert values with insert query in the

similar way---

 > insert into student value ('Dino' , 98) ; 


 > insert into student value ('Natu' , 96) ; 


 > insert into student value ('Ajit' , 95) ; 


 > insert into student value ('Rahul' , 94) ; 


 > insert into student value ('Lavina' , 97) ; 


Will give the following table ::

If You Think This Post has helped you buy us a Coffee :)

Make Donation

  • Other: $

Donate now