There are five constraints MySQL
A primary key constraint primary key (id)
Foreign key constraint 2
3 The only unique constraint
4-null constraint not null
5 default constraint default
other:
auto_increment value is automatically increased, generally used with primary key constraint
When the comment field of the comment table, create a table in the field
Affairs
Open transaction (in essence, turn off the automatic submission)
begin;
Submitted (in memory of the one-time changes committed to disk)
commit;
Rollback (remove the memory changes, roll back to the correct point)
rollback
type of data
Integer int (m) and BIGINT (m), m denotes a display length, when m is less than the length of the zero padding, requires a combination of keywords zerofill
Floating double (m, d), and ultra-precision floating-point decimal (m, d) m represents the total length, d for fractional length
String char (m) of fixed length, the maximum length of 255, the benefits of: high efficiency
varchar (m) of variable length, the maximum length of 65535 is recommended but greater than 255 text advantages: saving resources
text (m) of variable length, the maximum length of 65535
Date date: The date can only be saved
time: can only be saved when minutes and seconds
datetime: year, month, day, hour, maximum 9999-12-31, the default value is null
timestamp: timestamp date when minutes and seconds, maximum 2038-1-19, default is the current system time
other
Importing sql file
source file path
Export database (sql script)
mysqldump -u username -p database name> exported file name
mysqldump -u root -p db_name > test_db.sql
Exporting a mysql database table
mysqldump -u username -p database name watches> Export file name
mysqldump -u wcnc -p test_db users> test_users.sql (no semicolon at the end)