I am creating the database schema for any system and that i began to question something concerning the Integer datatypes in MySQL. I have seen that, a minimum of in Moodle, the datatypes are occasionally TINYINT (for things like flags), INT (for id amounts) or BIGINT (for nearly-infinite AI values, like user id's).

I'm wondering: so how exactly does affecting the particular database? Basically use INT for something similar to a flag (e.g 1 = pending, 2 = in process, 3 = revewing, 4 = processed) rather than TINYINT or BIGINT, will it has consequences? How about not establishing constraints? (Like, again, having a flag, using TINYINT(1) or TINYINT with no specific number)

The dimensions that you simply provide won't affect how information is saved.

So INT(11) is saved on disk exactly the same way as INT(3).

Together with your illustration of 1 = pending, 2 = in process, 3 = revewing, 4 = processed

I'd make use of an ENUM('pending', 'inprocess', 'revewing', 'processed') rather. That keeps it readable inside your code as well as in the information, although it offers the same speed as utilizing an integer.

You need to discover the different numeric datatypes and make your choice according to that.