Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.40-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| 血糖test |
| myschool |
| mysql |
| performance_schema |
| test |
| tpl |
+--------------------+
7 rows in set (0.28 sec)
mysql> select 血糖test;
ERROR 1054 (42S22): Unknown column ‘血糖test‘ in ‘field list‘
mysql> use 血糖test;
Database changed
mysql> show tables;
+--------------------+
| Tables_in_血糖test |
+--------------------+
| 血糖数据类别 |
| 血糖记录 |
| user1 |
| zfjtest |
+--------------------+
4 rows in set (0.06 sec)
mysql> select * from user1;
Empty set (0.25 sec)
mysql> insert into user1 values();
ERROR 1364 (HY000): Field ‘userid‘ doesn‘t have a default value
mysql> describe user1;
+--------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+--------------+------+-----+---------+-------+
| userid | varchar(255) | NO | PRI | NULL | |
| name | varchar(255) | YES | | NULL | |
| gender | varchar(255) | NO | | NULL | |
| age | varchar(255) | NO | | NULL | |
| ming | varchar(50) | YES | | NULL | |
+--------+--------------+------+-----+---------+-------+
5 rows in set (0.22 sec)
mysql> insert into user1 values(‘01‘,‘zhang‘,‘1‘,25,‘‘);
Query OK, 1 row affected (0.16 sec)
mysql> insert into user1 values(‘02‘,‘wang‘,‘1‘,25,0987);
Query OK, 1 row affected (0.06 sec)
mysql> select * from 血糖记录;
Empty set (0.12 sec)
mysql> describe 血糖记录;
+----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+----------------+
| 数值 | float(255,1) | NO | | NULL | |
| 时间 | datetime | NO | | NULL | |
| 类别 | int(255) | NO | | NULL | |
| 用户编号 | varchar(255) | NO | MUL | NULL | |
| 记录编号 | int(255) | NO | PRI | NULL | auto_increment |
| xb | enum(‘?‘) | YES | | NULL | |
+----------+--------------+------+-----+---------+----------------+
6 rows in set (0.04 sec)
mysql> insert into 血糖记录 values(4.1,‘2019-10-24‘,1,‘02‘,0001,1);
Query OK, 1 row affected (0.11 sec)
mysql> insert into 血糖记录 values(4.2,‘2019-10-25‘,1,‘02‘,0002,1);
Query OK, 1 row affected (0.04 sec)
mysql> insert into 血糖记录 values(4.3,‘2019-10-26‘,1,‘02‘,0003,1);
Query OK, 1 row affected (0.05 sec)
mysql> select * from 血糖记录;
+------+---------------------+------+----------+----------+------+
| 数值 | 时间 | 类别 | 用户编号 | 记录编号 | xb |
+------+---------------------+------+----------+----------+------+
| 4.1 | 2019-10-24 00:00:00 | 1 | 02 | 1 | ? |
| 4.2 | 2019-10-25 00:00:00 | 1 | 02 | 2 | ? |
| 4.3 | 2019-10-26 00:00:00 | 1 | 02 | 3 | ? |
+------+---------------------+------+----------+----------+------+
3 rows in set (0.03 sec)
mysql> select 数值,时间 from 血糖记录;
+------+---------------------+
| 数值 | 时间 |
+------+---------------------+
| 4.1 | 2019-10-24 00:00:00 |
| 4.2 | 2019-10-25 00:00:00 |
| 4.3 | 2019-10-26 00:00:00 |
+------+---------------------+
3 rows in set (0.01 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| ??test |
| 血糖test |
| myschool |
| mysql |
| performance_schema |
| test |
| tpl |
+--------------------+
8 rows in set (0.04 sec)
mysql> use tpl;
Database changed
mysql> show tables;
+---------------+
| Tables_in_tpl |
+---------------+
| 很好 |
| runoob_tbl |
| zfjtest |
+---------------+
3 rows in set (0.01 sec)
mysql> describe zfjtest;
+------------+-----------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-----------------+------+-----+---------+-------+
| 字符集test | varchar(255) | YES | | NULL | |
| xingb | enum(‘女‘,‘男‘) | YES | | 女 | |
+------------+-----------------+------+-----+---------+-------+
2 rows in set (0.29 sec)
mysql> CREATE DATABASE xtjl;
Query OK, 1 row affected (0.00 sec)
mysql> use xtjl;
Database changed
mysql> CREATE TABLE xtjlh (number float(255,1), jltime datetime,jlid varchar(255) primary key);
Query OK, 0 rows affected (0.34 sec)
mysql> insert into xtjlh values(4.1,‘2019-09-12‘,‘0001‘);
Query OK, 1 row affected (0.07 sec)
mysql> select *from xtjlh;
+--------+---------------------+------+
| number | jltime | jlid |
+--------+---------------------+------+
| 4.1 | 2019-09-12 00:00:00 | 0001 |
+--------+---------------------+------+
1 row in set (0.00 sec)
mysql> insert into xtjlh values(4.2,‘2019-09-13‘,‘0002‘);
Query OK, 1 row affected (0.09 sec)
mysql> insert into xtjlh values(4.3,‘2019-09-14‘,‘0003‘);
Query OK, 1 row affected (0.06 sec)
mysql> insert into xtjlh values(4.5,‘2019-09-15‘,‘0004‘);
Query OK, 1 row affected (0.06 sec)
mysql> USE XTJL;
Database changed
mysql> create database bysj CHARACTER SET utf8 COLLATE utf8_general_ci;use bysj;
CREATE TABLE tb_Client(CId int auto_increment NOT NULL ,CLoginname VARCHAR(255) COLLATE Chinese_PRC_CI_AS NOT NULL,CPwd VARCHAR(255) NOT NULL,CRealname VARCHAR(255) COLLATE Chinese_PRC_CI_AS NOT NULL,CEmail VARCHAR(255),CTel VARCHAR(255),PRIMARY KEY( CId))ENGINE=InnoDB DEFAULT CHARSET=utf8;
Query OK, 1 row affected (0.06 sec)
Database changed
mysql> CREATE TABLE tb_Client(CId int auto_increment NOT NULL ,CLoginname VARCHAR(255) NOT NULL,CPwd VARCHAR(255) NOT NULL,CRealname VARCHAR(255) NOT NULL,CEmail VARCHAR(255),CTel VARCHAR(255),PRIMARY KEY( CId))ENGINE=InnoDB DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.20 sec)
mysql> describe tb_Client
-> ;
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| CId | int(11) | NO | PRI | NULL | auto_increment |
| CLoginname | varchar(255) | NO | | NULL | |
| CPwd | varchar(255) | NO | | NULL | |
| CRealname | varchar(255) | NO | | NULL | |
| CEmail | varchar(255) | YES | | NULL | |
| CTel | varchar(255) | YES | | NULL | |
+------------+--------------+------+-----+---------+----------------+
6 rows in set (0.03 sec)
mysql> select * from tb_Client;
Empty set (0.00 sec)
mysql> select * from tb_Client;
+-----+------------+------+-----------+--------+------+
| CId | CLoginname | CPwd | CRealname | CEmail | CTel |
+-----+------------+------+-----------+--------+------+
| 1 | zhang | 0987 | ??? | Cemail | Ctel |
+-----+------------+------+-----------+--------+------+
1 row in set (0.00 sec)
mysql> select * from tb_Client;
+-----+------------+------+-----------+--------+------+
| CId | CLoginname | CPwd | CRealname | CEmail | CTel |
+-----+------------+------+-----------+--------+------+
| 1 | zhang | 0987 | ??? | Cemail | Ctel |
| 2 | zhangmy | 0987 | ?? | 0987 | 189 |
+-----+------------+------+-----------+--------+------+
2 rows in set (0.00 sec)
mysql> Select count(*) From tb_Client where CLoginname=‘zhang‘ and CPwd=0987;
+----------+
| count(*) |
+----------+
| 1 |
+----------+
1 row in set (0.07 sec)
mysql> Select count(*) From tb_Client where CLoginname=‘zhang3‘ and CPwd=0987;
+----------+
| count(*) |
+----------+
| 1 |
+----------+
1 row in set (0.08 sec)
mysql> Select * From tb_Client where CLoginname=‘zhang3‘ and CPwd=0987;
+-----+------------+------+-----------+--------+------+
| CId | CLoginname | CPwd | CRealname | CEmail | CTel |
+-----+------------+------+-----------+--------+------+
| 3 | zhang3 | 0987 | ??? | Cemail | Ctel |
+-----+------------+------+-----------+--------+------+
1 row in set (0.00 sec)
mysql> use tpl;
Database changed
mysql> describe zfjtest;
+------------+-----------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-----------------+------+-----+---------+-------+
| 字符集test | varchar(255) | YES | | NULL | |
| xingb | enum(‘女‘,‘男‘) | YES | | 女 | |
+------------+-----------------+------+-----+---------+-------+
2 rows in set (0.17 sec)
mysql> Select * From zfjtest;
+------------+-------+
| 字符集test | xingb |
+------------+-------+
| 张1意 | 女 |
+------------+-------+
95 rows in set (0.06 sec)
mysql> show table status from bysj like ‘tb_Client‘;
+-----------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
+-----------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------+
| tb_client | InnoDB | 10 | Compact | 3 | 5461 | 16384 | 0 | 0 | 6291456 | 4 | 2020-02-28 15:30:50 | NULL | NULL | utf8_general_ci | NULL | | |
+-----------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------+
1 row in set (0.07 sec)
mysql> use bysj;
Database changed
mysql> use bysj;
Database changed
mysql> insert into tb_Client (CLoginname,CPwd,CRealname) values (‘zhang4‘,‘0987‘,‘张1意‘);
Query OK, 1 row affected (0.08 sec)
mysql> Select * From tb_Client;
+-----+------------+------+-----------+--------+------+
| CId | CLoginname | CPwd | CRealname | CEmail | CTel |
+-----+------------+------+-----------+--------+------+
| 1 | zhang | 0987 | ??? | Cemail | Ctel |
| 2 | zhangmy | 0987 | ?? | 0987 | 189 |
| 3 | zhang3 | 0987 | ??? | Cemail | Ctel |
| 4 | zhang4 | 0987 | 张1意 | NULL | NULL |
+-----+------------+------+-----------+--------+------+
4 rows in set (0.00 sec)
mysql> use bysj;
Database changed
mysql> CREATE TABLE xtjl ( jltime datetime,type int(1) ,number float(2,2),jlid int auto_increment NOT NULL ,clientid int(11) ,PRIMARY KEY( jlid));
Query OK, 0 rows affected (0.79 sec)
mysql> describe xtjl;
+----------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------+------+-----+---------+----------------+
| jltime | datetime | YES | | NULL | |
| type | int(1) | YES | | NULL | |
| number | float(2,2) | YES | | NULL | |
| jlid | int(11) | NO | PRI | NULL | auto_increment |
| clientid | int(11) | YES | | NULL | |
+----------+------------+------+-----+---------+----------------+
5 rows in set (0.24 sec)
mysql> insert into xtjl (jltime,type,number,clientid) values(‘2020-03-02‘,2,‘5.54‘,2);
Query OK, 1 row affected (0.04 sec)
mysql> select *from xtjl;
+---------------------+------+--------+------+----------+
| jltime | type | number | jlid | clientid |
+---------------------+------+--------+------+----------+
| 2020-03-01 00:00:00 | 2 | 4.50 | 1 | NULL |
| 2020-03-01 00:00:00 | 3 | 4.68 | 2 | NULL |
| 2020-03-02 00:00:00 | 2 | 5.50 | 3 | 1 |
| 2020-03-02 00:00:00 | 2 | 5.54 | 4 | 2 |
+---------------------+------+--------+------+----------+
mysql> update tb_client set CLoginname="name" ,CPwd="555" ,CRealname="陈心",CEmail="",CTel="" where CId=1;
Query OK, 1 row affected (0.23 sec)
Rows matched: 1 Changed: 1 Warnings: 0