1,创建表
mysql> create table student(
-> id int primary key,
-> name varchar(20) not null,
-> grade float
-> );
插入记录
mysql> insert into student values(1,'monkey',98.5);
Query OK, 1 row affected (0.01 sec)
一次性插入多条记录
mysql> insert into student values(2,'bob',95.5),(3,'john',90.0),(4,'smith',88.5
);
Query OK, 3 rows affected (0.01 sec)
Records: 3 Duplicates: 0 Warnings: 0
部分数据插入
mysql> insert into student values(5,'jone',null);
Query OK, 1 row affected (0.01 sec)
修改值
mysql> update student set
-> grade = grade+ 0.5 where grade > 90;
Query OK, 2 rows affected (0.01 sec)
Rows matched: 2 Changed: 2 Warnings: 0
创建用户,授予权限
mysql> create user test1@'localhost' identified by '123';
Query OK, 0 rows affected (0.02 sec)
mysql> grant select on db_system.student to test1@'localhost';
Query OK, 0 rows affected (0.01 sec)
查询权限
删除用户
mysql> drop user test1@'localhost';
Query OK, 0 rows affected (0.01 sec)