Data types examples and exercises

In this chapter you will learn:
Example of data types
Some exercises of data types

Example of data types

Create a database with the name student and create a student_details table. Insert three columns in this table with the data type and size. The columns should be:

  1. StudentId – integer data type
  2. StudentName – char data type
  3. StudentAddress – varchar data type
create database student

create table student_details
StudentId int,
StudentName char(50),
Address varchar(50)

Example Description

In the above example create database student is used to create the database of the name of student in which create table student_details is used to creating the table and StudentId int is used to create columns in the database table in which StudentId is the name of table and int is a data type that means the StudentId column stores only integer type of data.


  1. What do you mean by data types?
  2. What is the purpose to use date data types?
  3. Create a table in student database, the name of the table should be StudentResult in which insert 5 columns that details are given below.

    StudentId - int
    StudentName – varchar 30
    Phy –int
    Che – int
    Total – int
SUMMARY In this chapter you have learned about data types, types of data type, data type category, list of all data types, examples of data type. Next chapter isoperators so click on Next button to know about operator.

Share your thought