SQL数据库表的创建

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

开发工具与关键技术:SQL、

作者:#33

撰写时间:撰写时间:2019年06月22日

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

学习关于数据库表的创建:

先下数据库右键新建一个数据库,在新建查询使用代码创建表。

创建表:球员表、国籍表、场上位置表、球队表

create table 表名(创建的字段,数据类型)

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 表名(插入内容的字段名)values(分别插入的值);

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. '湖人');

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值