mysql> create database studentdb default character set utf8;
Query OK, 1 row affected
mysql> use studentdb;
Database changed
mysql> create table t_course (cno char(3) not null primary key,cname varchar(32) not null,cpoint smallint,remark varchar(500))engine=innodb;
Query OK, 0 rows affected
mysql> insert into t_course set cno='C01',cname='android编程',cpoint=3,remark='手机编程';
Query OK, 1 row affected
mysql> insert into t_course set cno='C02',cname='java',cpoint=2,remark='编程语言';
Query OK, 1 row affected
mysql> replace into t_course set cno='C03',cname='python',cpoint=3,remark='编程语言';
Query OK, 1 row affected
mysql> insert into t_course(cno,cname,cpoint)values('C04','html','4');
Query OK, 1 row affected
mysql> update t_course set cname='java编程基础' where cno='C02';
Query OK, 1 row affected
Rows matched: 1 Changed: 1 Warnings: 0
mysql> update t_course set cpoint=cpoint+1 where cno='C03';
Query OK, 1 row affected
Rows matched: 1 Changed: 1 Warnings: 0
mysql> update t_course set cpoint=4 where cno='C01';
Query OK, 1 row affected
Rows matched: 1 Changed: 1 Warnings: 0
mysql> delete from t_course where cno='C03';
Query OK, 1 row affected
mysql> delete from t_course where cpoint<3;
Query OK, 1 row affected
mysql> select * from t_course;
+
| cno | cname | cpoint | remark |
+
| C01 | android编程 | 4 | 手机编程 |
| C04 | html | 4 | NULL |
+
2 rows in set
mysql> select cpoint from t_course;
+
| cpoint |
+
| 4 |
| 4 |
+
2 rows in set
mysql> select cpoint from t_course where cno='C04';
+
| cpoint |
+
| 4 |
+
1 row in set
mysql> select cpoint from t_course where cname='html';
+
| cpoint |
+
| 4 |
+
1 row in set
mysql> select cno from t_course where cname='html';
+
| cno |
+
| C04 |
+
1 row in set