Databases Flashcards
What is VARCHAR
Used to store non-numeric values that can be up to 255 characters and vachar will only use the space required for each record that is stored in the database.
What is CHAR
Used to store non-numeric values, however, it will use up all space for the set number regardless of what value is added
What is INT
Used to store integers and columns that you will find mostly using the INT are things like a unique identifier for each table.
What is BIGINT
Biginit would be used for columns that would need to store huge numbers. In most cases, you wouldn’t need BIGINT, but if you wanted to store something like Facebook I’d when using Facebook’s API, since they have over a billion users the id will need to be a data type of BIGINT
What is TINYINT
TINYINT would be good to use for numbers that will be relatively small. A good example of something that would use a TINYINT is user level identifier (0 - inactive user, 1 - active user, 9 - admin)
What is a FLOAT
Used to store point numbers (numbers that need to have decimal places)
What is TEXT
Uses to store large amount of text, like a description, message or comment. Use this for any text that VARCHAR() is to small to handle
What is DATETIME
Used to store a date and time in the format YYYY-MM-DD