编辑代码


CREATE DATABASE test;
use test;
CREATE TABLE class(bjid int primary key,cjname char(10));
CREATE TABLE student(xid int primary key auto_increment,xname char(10),xage int,bjid int);
alter table student add constraint abc foreign key(bjid) references class(bjid);	
describe student;
select*from student;
select*from student where xage=18;
select*from student where xage in(15,16,17);
select*from student where xname like('小%');
describe student;



------------------------------------------------------------------------------------------


CREATE DATABASE test;
use test;
CREATE TABLE class(bjid int primary key,cjname char(10));
CREATE TABLE student(xid int primary key auto_increment,xname char(10),xage int,bjid int);
alter table student add constraint abc foreign key(bjid) references class(bjid);	
describe student;
select*from student;
select*from student where xage=18;
select*from student where xage in(15,16,17);
select*from student where xname like('小%');
describe student;