1. Insert data into the t_student database table
Note: the inserted data must correspond to the data table fields one by one
insert into t_student values (1,'张三','男',18,'2022-5-8','软件1班','[email protected]');
Insert data into the data table
insert into table name value (data 1, data 2, data 3, ...)
2. The width of int is the display width. If it exceeds, the width can be increased automatically. The bottom layer of int is 4 bytes.
insert into t_student values (10010010,'张三','男',18,'2022-5-8','软件1班','[email protected]');
When creating the table, set the sno field to 6.
3. There are various time formats '1256-12-23', '1256/12/23', '1256.12.23'. The
newly created statements are all '1256-12-23' 'Format
4, the string does not distinguish between single quotes and double quotes
' Zhang San' and "Zhang San"
insert into t_student values (2,'张三','男',18,'2022.5.8','软件1班','[email protected]');
insert into t_student values (2,"张三",'男',18,'2022.5.9','软件1班','[email protected]');
5. How to write the current time now(), sysdate(), CURRENT_DATE()
now()
insert into t_student values (3,"张三",'男',18,now(),'软件1班','[email protected]');
6. char varchar is the number of characters, not the number of bytes, you can use binary, varbinary means the number of bytes with fixed length and variable length.
The name field set when creating the table does not allow more than 10 characters
insert into t_student values (4,"美国迈克尔乔丹篮球之神",'男',18,now(),'软件1班','[email protected]');
The result of the operation will report an error. The reason for the error is that the text of sname is too long
. 7. If the data is not inserted in all fields, you need to add the name of the field
insert into t_student values(10,'李四','2021-1-1')
An error will be reported as a result of the operation, and the cause of the error does not tell me what fields these 3 fields represent.
Solution: specify which fields the inserted information corresponds to one by one
insert into t_student (sno,sname,enterdate) values(10,'李四','2021-1-1')