数据库的索引以及数据的输入输出
1.mysql> create table t5 (name char(5),age int(3),primary key(name,age))设置联合主键
mysql> insert into t5 values ("aa",9);
Query OK, 1 row affected (0.00 sec)
mysql> insert into t5 values ("aa",10);
Query OK, 1 row affected (0.00 sec)
mysql> insert into t5 values ("bb",10);
Query OK, 1 row affected (0.01 sec)
mysql> select * from t5
-> ;
+------+-----+
| name | age |
+------+-----+
| aa | 9 |
| aa | 10 |
| bb | 10 |
+------+-----+
3 rows in set (0.00 sec)
mysql> insert into t5 values ("aa",10);
ERROR 1062 (23000): Duplicate entry 'aa-10' for key 'PRIMARY'
必须两个字段的值一样时才会插入不成功