Mysql workbench 建立表(Student,Course,SC) 每个表中插入数据

Mysql workbench 建立表(Student,Course,SC) 每个表中插入数据

首先默认你已经创建了数据库了,在该数据库中建立表(如果没有建立,请移驾https://editor.csdn.net/md/?articleId=105425265)

创建表Student

1,采用Sql语句

create table `taotao2`.`Student`    /*注意标点·,不是单引号*/
(
Sno char(9) primary key,
Sname char(20) unique,
Ssex smallint ,
Sdept char(20)

);

注意:1,taotao2表示你的schemas名。

2.采用GUI操作

1
在你的schemas上找到Tables 右键,

->Create Tables
->2->根据需要填,
注意最后点击apply(you must click )

->同理把Course 、和 SC建立完成。

插入数据

在Student表中插入数据
1.1Sql语句

insert 
into `taotao2`.`Student`
values('201803045','范范','男',19,'JX');

注意,这里的Sage 使用smallint型,但是这里加不加‘’都行,我还是不加吧。

1.2GUI操作


见图,直接操作。

同理对Course 表和SC表的插入操作,请大家自己尝试。

友情提示(如果觉得对您有帮助,记得评论区回复1 ,如何有疑问请留言,相信许多大佬会帮我们的。)

猜你喜欢

转载自blog.csdn.net/qq_44218805/article/details/105441466
今日推荐