mysql8基础 insert 指定字段,插入一条记录

  •                  OS : Ubuntu 18.04.1 LTS
  •             DBMS : mysql 8.0.12
  •                blog : blog.csdn.net/shiwanwu
  •             github : github.com/GratefulHeartCoder
  •      typesetting : Markdown

数据,数据,命根就在数据 ! 操作数据库时,一定要谨慎小心。师万物 这里的代码看看就好,要有自己的判断。遇到抉择,要不耻上下问。

example

stu@Ubuntu:~$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 31
Server version: 8.0.12 MySQL Community Server - GPL

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use db_chinese_medicine;                                                 Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> insert into t_fruit (name,count,price,is_sales,note,gmt_create,gmt_modified) values('甘蔗',50,7.65,0,default,now(),now());
Query OK, 1 row affected (0.07 sec)

mysql> select * from t_fruit;
+----+--------+-------+-------+----------+------+---------------------+---------------------+
| id | name   | count | price | is_sales | note | gmt_create          | gmt_modified        |
+----+--------+-------+-------+----------+------+---------------------+---------------------+
|  1 | 甜瓜   |    10 | 3.210 |        1 || 2018-10-27 19:42:56 | 2018-10-27 19:42:56 |
|  2 | 乌梅   |    20 | 5.430 |        1 || 2018-10-27 19:46:21 | 2018-10-27 19:46:21 |
|  3 | 樱桃   |    30 | 6.540 |        1 || 2018-10-27 19:46:48 | 2018-10-27 19:46:48 |
|  4 | 甘蔗   |    50 | 7.650 |        0 || 2018-10-27 19:51:13 | 2018-10-27 19:51:13 |
+----+--------+-------+-------+----------+------+---------------------+---------------------+
4 rows in set (0.00 sec)

mysql> exit
Bye
stu@Ubuntu:~$ 

resource


MySQL是一个关系型数据库管理系统,目前是开源的(2018-10)。
权限明确,恰当选择引擎与字符集,命名简洁明了与规范。
MariaDB,Redis,MongoDB,PostgreSQL,Hive,HBase等,可以简单地了解。
Workbench,phpMyAdmin,Navicat等图形化管理工具,可以试用一下。

猜你喜欢

转载自blog.csdn.net/shiwanwu/article/details/83449837