Data Types

This lesson talks about the various data types available in MySQL.

We'll cover the following

Data Types

In the previous lesson we created a database and now we’ll learn how to create tables within a database. But before we create a table, we’ll examine the concept of a table. A database is primarily made up of tables and as explained before, a table consists of columns. Each column is an attribute of an entity that is defined by the table. For instance, the first table we’ll create will consist of actors. What information do we want to hold about actors? We can be interested in the first and last names, age, date of birth, marital status, gender, etc., of an actor, all attributes that define some aspect of an actor.

Our table, Actors, will consist of columns that represent the age, gender, date of birth, etc., for an actor. However, note that a name will consist of alphabets, age will be a number, and date of birth will be a date. MySQL provides various data types to represent the type of columns in a table. The analogy is similar to a strongly-typed language such as Java or C# which allows a developer to define a type for each variable. This strong typing and sizing make the data in relational databases structured. The major categories of various data-types are as follows:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.