数据库设计工具的使用(实用)

本文介绍了一种使用数据库设计工具自动生成SQL语句的方法,并详细展示了创建教师、课程及教学关系表的过程。此外,还提供了PowerDesigner的学习资源及下载指南。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用数据库设计工具,以下sql语句全部可以自动生成:

/*==============================================================*/
/* DBMS name:      MySQL 5.0                                    */
/* Created on:     2017/5/27 0:57:18                            */
/*==============================================================*/


drop table if exists Teacher;

drop table if exists course;

drop table if exists teach;

/*==============================================================*/
/* Table: Teacher                                               */
/*==============================================================*/
create table Teacher
(
   tid                  int not null,
   teacherName          varchar(20) not null,
   sex                  char(1) not null default 'm',
   birthday             date,
   major                varchar(30),
   primary key (tid)
);

alter table Teacher comment '教师实体对象,存放教师信息';

/*==============================================================*/
/* Table: course                                                */
/*==============================================================*/
create table course
(
   cid                  int not null,
   cname                varchar(20) not null,
   chour                int,
   credit               numeric(2,0),
   primary key (cid)
);

alter table course comment '课程信息';

/*==============================================================*/
/* Table: teach                                                 */
/*==============================================================*/
create table teach
(
   tid                  int not null,
   cid                  int not null,
   starttime            datetime,
   primary key (tid, cid)
);

alter table teach add constraint FK_teach foreign key (tid)
      references Teacher (tid) on delete restrict on update restrict;

alter table teach add constraint FK_teach2 foreign key (cid)
      references course (cid) on delete restrict on update restrict;

只要建立实体,添加实体间属性,实体间关系表也可以自动生成。如下图:
这里写图片描述

PowerDsigner的具体使用方法大家可以百度一个PDF文件或者视频学习。

PowerDesigner下载攻略:
先百度

这里写图片描述

找破解方案

这里写图片描述

按照破解文档操作即可使用。

亲测最简便上手方案。

关于数据库的设计等问题在我之前的博客中都有分享哦。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值