~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
开发工具与关键技术:SQL、
作者:#33
撰写时间:撰写时间:2019年06月22日
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
学习关于数据库表的创建:
先下数据库右键新建一个数据库,在新建查询使用代码创建表。
创建表:球员表、国籍表、场上位置表、球队表
create table Hoopman (HoopmanID int not null. HoopmanName varchar(25).HoopmanNum varchar(25). Age varchar(25).Sex varchar(25).Stature varchar(25).Weight varchar(25). NationalityID int.PositionID int.BasketballTeamID int.); create table Nationality (NationalityID int not null.Nationality varchar(25).); create table Position (PositionID int not null.Position varchar(25).); create table BasketballTeam (BasketballTeamID int not null.BasketballTeam varchar(25).); 数据插入:球员表数据
insert into Hoopman (HoopmanID.HoopmanName.HoopmanNum.Age.Sex.Stature.Weight.NationalityID.PositionID.BasketballTeamID) values (1. '斯蒂芬-库里'.'30'.'31'.'男'.'190'.'86'.'2'.'1'.'1'); insert into Hoopman (HoopmanID.HoopmanName.HoopmanNum.Age.Sex.Stature.Weight.NationalityID. PositionID.BasketballTeamID) values (2. '凯里-欧文'.'11'.'27'.'男'.'190'.'87'.'3'.'1'.'2'); insert into Hoopman (HoopmanID.HoopmanName.HoopmanNum.Age.Sex.Stature.Weight.NationalityID. PositionID.BasketballTeamID) values (3. '克莱-汤普森'.'11'.'29'.'男'.'201'.'97'.'2'.'2'.'2'); insert into Hoopman (HoopmanID.HoopmanName.HoopmanNum.Age.Sex.Stature.Weight.NationalityID. PositionID.BasketballTeamID) values (4. 'JR-史密斯'.'5'.'34'.'男'.'198'.'102'.'2'.'2'.'4'); insert into Hoopman (HoopmanID.HoopmanName.HoopmanNum.Age.Sex.Stature.Weight.NationalityID. PositionID.BasketballTeamID) values (5. '科怀-伦纳德'.'2'.'28'.'男'.'201'.'104'.'2'.'4'.'3'); insert into Hoopman (HoopmanID.HoopmanName.HoopmanNum.Age.Sex.Stature.Weight.NationalityID. PositionID.BasketballTeamID) values (6. '凯文-杜兰特'.'35'.'31'.'男'.'206'.'108'.'2'.'4'.'1'); insert into Hoopman (HoopmanID.HoopmanName.HoopmanNum.Age.Sex.Stature.Weight.NationalityID. PositionID.BasketballTeamID) values (7. '扬尼斯-安特托昆博'.'34'.'26'.'男'.'211'.'109'.'4'.'5'.'5'); insert into Hoopman (HoopmanID.HoopmanName.HoopmanNum.Age.Sex.Stature.Weight.NationalityID.PositionID.BasketballTeamID) values (8. '勒布朗-詹姆斯'.'23'.'34'.'男'.'203'.'113'.'2'.'4'.'6'); 国籍表数据: insert into Nationality (NationalityID. Nationality) values (1. '中国'); insert into Nationality (NationalityID. Nationality) values (2. '美国'); insert into Nationality (NationalityID. Nationality) values (3. '澳洲'); insert into Nationality (NationalityID. Nationality) values (4. '希腊'); 场上位置表数据 insert into Position (PositionID. Position) values (1. '控球后卫'); insert into Position (PositionID. Position)values (2. '得分后卫'); insert into Position (PositionID. Position)values (3. '大前锋'); insert into Position (PositionID. Position)values (4. '小前锋'); insert into Position (PositionID. Position)values (5. '中锋'); 球队表数据: insert into BasketballTeam(BasketballTeamID.BasketballTeam)values(1.'勇士'); insert into BasketballTeam(BasketballTeamID.BasketballTeam)values(2.'凯尔特人'); insert into BasketballTeam (BasketballTeamID. BasketballTeam)values (3. '猛龙'); insert into BasketballTeam (BasketballTeamID. BasketballTeam)values (4. '骑士'); insert into BasketballTeam (BasketballTeamID. BasketballTeam)values (5. '雄鹿'); insert into BasketballTeam (BasketballTeamID. BasketballTeam)values (6. '湖人'); |