Home>
I felt uncomfortable when operating mariaDB.
Isn't it an error to put a character string in a column with int specified at the table definition stage?
Also, if 11 characters or more are entered with varchar (10) etc., this will not be an error and will be truncated at 10 characters.
MariaDB [db]>create table test (id int (11) primary key);
Query OK, 0 rows affected (0.04 sec)
MariaDB [employee_db]>show columns from test;
+ ------- + --------- + ------ + ----- + --------- + ------- +
| Field | Type | Null | Key |
+ ------- + --------- + ------ + ----- + --------- + ------- +
id | int (11) | YES | | NULL |
+ ------- + --------- + ------ + ----- + --------- + ------- +
1 row in set (0.03 sec)
MariaDB [db]>insert into test (id) values ("Ah Ah Ah Ah");
Query OK, 1 row affected, 1 warning (0.01 sec)
MariaDB [db]>select * from test \ G
*************************** 1. row ******************** *******
id: 0
1 row in set (0.00 sec)
Is there an error in this case?
Please give me an answer if you understand.
-
Answer # 1
-
Answer # 2
MariaDB and its original MySQL also have a place where the check of data entering the table is relaxed and ignored without causing an error to prevent performance degradation.
To that extent, MariaDB covers with the ability of the program writer. In severe demanding systems such as banks, Oracle is often used to check properly.
Related articles
- mysql - question about how to count sql
- i have a question about basic python problems
- i have a question about a simple problem with [java] files
- mysql + sqlalchemy, about relations
- postgresql - about cross-join in the question about the percentile of 100 data scientist knocks
- java - this is a question about an application problem using a simple for statement
- java - i have a question about new
- ruby - i have a question about rails routing errors
- i have a question about a problem with python i tried many times
- php - mysql insert instruction error
- mysql - about the setting to connect to the db in docker from the sql client
- vuejs - question about how to arrange side by side using v-for in vue
- mysql - about docker error
- python - i have a question about multiple updates of pymongo
- i have a question about php overloading
- mariadb - how to check mysql port 3306?
- php - please tell me about freeing mysql memory
- about errors when connecting to mysql (codeigniter, xdebug, mysql)
- mysql - about the database
- about building mysql ndb cluster
Related questions
- Update Column from Recursive CTE (MySQL /MariaDB)
- mysql - about db table naming
- [mysql] about the phenomenon that the index cannot be pasted without using constraint
- xampp mysql (mariadb) phpmyadmin does not open
- mysql - i want to reflect max_allowed_packet in mariadb
- cannot log in to mysql with administrator privileges
- cannot get id column array using select statement in php and mysql
- error when executing sql in php
- mysql - i can't access the database even though i should have granted the permission with the grant statement in mariadb
- can't connect to mysql launched by docker
MariaDB (and MySQL) has the concept of
SQL_MODE
(MariaDB official).If
IfSQL_MODE
isSTRICT_TRANS_TABLES
orSTRICT_ALL_TABLES
...INSERT
with an inappropriate value fails Rolled back.SQL_MODE
is set differently ... Inappropriate values may be converted by MariaDB andINSERT
as appropriate values.