1.create table test(
id int (4) not null primary key auto_increment,
name char(20) not null
);
这个表以id作为主键(唯一标识这个数据表的),auto_increment标识当插入数据缺失id时,默认id为表id的下个数字,not null表示不允许为空。
2.create table test1(
name char(20) not null primary key,
age int (3) not null
id int (4) not null primary key auto_increment,
name char(20) not null
);
这个表以id作为主键(唯一标识这个数据表的),auto_increment标识当插入数据缺失id时,默认id为表id的下个数字,not null表示不允许为空。
2.create table test1(
name char(20) not null primary key,
age int (3) not null
);
3.两个表通过name的连接:select test.id,test.name,test1.age from test,test1 where test.name=test1.name;
select test.id,test.name,test1.age from test,test1 where test.name=test1.name and test.name='xiaoke' ;