-- 實(shí)驗(yàn)表結(jié)構(gòu)
create table student(
id int,
name varchar(15),
gender varchar(15),
cid int
);
create table class(
cid int,
cname varchar(15)
);
drop table student,class;
-- 實(shí)驗(yàn)表數(shù)據(jù):
insert into student values(1,"lilei","male",1),(2,"hanmeimei","male",2),(3,"jack","male",1),(4,"alice","female",4); --這里特意創(chuàng)建了一個(gè)class中沒有的4
insert into class values(1,"linux"),(2,"python"),(3,"java"),(5,"html5");--這里特意創(chuàng)建了一個(gè)student中沒有的5
select * from student;
select * from class;
更多關(guān)于MySQL相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《MySQL查詢技巧大全》、《MySQL事務(wù)操作技巧匯總》、《MySQL存儲過程技巧大全》、《MySQL數(shù)據(jù)庫鎖相關(guān)技巧匯總》及《MySQL常用函數(shù)大匯總》