** Day 17 of Calendar Planning 2020 ** It's been about 3 months since I started studying programming, so I will leave a note of what I learned in the article as an output. I would be happy if I could help anyone entering the world of programming. Please let me know if there are any words that are wrong, wrong, or misunderstood ^^ I'm sorry if it's hard to read the words for a long time. I will do my best to get used to it little by little.
Here I have summarized the database tables. That's where the column came in. The data type has the role of limiting (conditioning) the column.
For example Wouldn't it be a bit of a problem if the amount of money was entered on an online shopping site? Normally, I would like to enter only the price "2980", but if I do it without restrictions, only the "special price" will be displayed instead of the price due to mistakes on the store side and I do not know the essential price. I can think of it. Besides, if you want to pay the total amount but the characters are included, it will not work properly and it will be annoying to customers.
It's a little difficult to understand, but you can prevent the data that you don't originally want from being included.
Data type | Restricted content |
---|---|
integer | Numerical value (integer) |
decimal | Numerical value (highly accurate decimal number) |
float | Numerical value (floating point number) |
string | letter(~(Short character string up to 255 characters) |
text | Character (long string) |
date | date |
datetime | Date and time |
time | Times of Day |
timestamp | Time stamp |
binary | binary |
boolean | Authenticity |
AUTOINCREMENT
A function that automatically assigns numbers in sequence. Often used for ID. Accounts and posts are assigned in order of creation, starting from 1.
NOT NULL
A function that prohibits blanks. It's a good idea to add this to items that aren't empty when you save them! For example I don't want to be registered with the password for creating an account, so I can add it If you want your blog to have a title, you can add it to the column corresponding to the title.
DEFAULT
Ability to set initial values. When the record is registered, the column value is automatically entered and registered.
UNIQUE
This is a function that prohibits duplication. It is used when you want to prohibit registration with the same e-mail address or when you have duplicate passwords.
I think there are others, so if you are interested, please check it out.
When creating columns in this way, you can limit them at the same time and set rules to prevent erroneous operations when you start operating the application. This first design is quite important, isn't it?
Recommended Posts