這篇文章主要講解了“數(shù)據(jù)庫SQL語句的使用”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“數(shù)據(jù)庫SQL語句的使用”吧!
十載專注成都網(wǎng)站制作,成都定制網(wǎng)站,個(gè)人網(wǎng)站制作服務(wù),為大家分享網(wǎng)站制作知識、方案,網(wǎng)站設(shè)計(jì)流程、步驟,成功服務(wù)上千家企業(yè)。為您提供網(wǎng)站建設(shè),網(wǎng)站制作,網(wǎng)頁設(shè)計(jì)及定制高端網(wǎng)站建設(shè)服務(wù),專注于成都定制網(wǎng)站,高端網(wǎng)頁制作,對成都輕質(zhì)隔墻板等多個(gè)行業(yè),擁有多年的網(wǎng)站設(shè)計(jì)經(jīng)驗(yàn)。
1、創(chuàng)建數(shù)據(jù)庫 create database if not exists cs2013; 2、創(chuàng)建數(shù)據(jù)庫表格 create table if not exists comp ( id int not null primary key auto_increment , pid varchar(30) not null unique , cname varchar(30) not null , ename varchar(30) not null , grade varchar(30) not null , sex int not null , clothe varchar(15) not null )default charset = utf8; create table if not exists team ( id int not null primary key auto_increment , cname varchar(30) not null , ename varchar(30) not null , coach0 int not null , coach2 int not null , stu0 int not null , stu1 int not null , stu2 int not null , isgirls int not null , email varchar(30) not null , phone varchar(15) not null , foreign key (coach0) references comp(id) , foreign key (coach2) references comp(id) , foreign key (stu0) references comp(id) , foreign key (stu1) references comp(id) , foreign key (stu2) references comp(id) )default charset = utf8; create table if not exists college ( id int not null primary key auto_increment, cname varchar(30) not null , ename varchar(30) not null , teamcnt int not null )default charset = utf8; create table if not exists rc ( id int not null primary key auto_increment , college int not null , team int not null , date date not null , foreign key (college) references college (id) , foreign key (team) references team (id) )default charset = utf8; create table if not exists room ( id int not null primary key auto_increment, name varchar(30) not null , totcnt int not null , regcnt int not null , price double not null )default charset = utf8; create table if not exists hotel ( id int not null primary key auto_increment, name varchar(30) not null , room0 int not null , room1 int not null , room2 int not null , foreign key (room0) references room (id) , foreign key (room1) references room (id) , foreign key (room2) references room (id) )default charset = utf8; create table if not exists rh ( id int not null primary key auto_increment, college int not null , hotel int not null , date date not null , foreign key (college) references college (id) , foreign key (hotel) references hotel (id) )default charset = utf8;
感謝各位的閱讀,以上就是“數(shù)據(jù)庫SQL語句的使用”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對數(shù)據(jù)庫SQL語句的使用這一問題有了更深刻的體會,具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識點(diǎn)的文章,歡迎關(guān)注!