下载此文档

2016-2017学年度高中物理 第八章 气体章末整合提升课件 新人教版选修3-3.ppt


文档分类:中学教育 | 页数:约11页 举报非法文档有奖
1/11
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/11 下载此文档
文档列表 文档介绍
计算机科学与软件工程学院
数据库系统概论
An Introduction to Database System
第三章关系数据库标准语言SQL
An Introduction to Database System
第三章关系数据库标准语言SQL SQL概述
SQL的特点
1. 综合统一: 包含了数据定义、数据操纵、数据控制
2、两种使用方式:独立使用或嵌入高级语言中使用
3. 非过程化:只提操作要求,不必描述操作过程和步骤,也不需要导航
4. 语言简洁,易学易用、好学好用:在ANSI标准中,只包含了94个英文单词,核心功能6个动词,语法接近英语口语
An Introduction to Database System
语言简捷,易学易用
An Introduction to Database System
定义语句格式
CREATE TABLE 表名
(字段1,类型[ not null] [unique],字段2,类型[ not null] [unique]…)
Primary key 和 unique 的区别?
Unique:限定非空的值唯一,没有限定该值不能为空.
Type:
Numric 数值
smallint 半字长二进制整数 INT(integer) 全字
Decimal(DEC) 十进制小数型
Float 双字长浮点数 Real 实数
Double precision 双精度 Character(CHAR) 字符型
An Introduction to Database System
定义语句格式
[例1] 建立一个“学生”表Student,它由学号Sno、姓名Sname、性别Ssex、年龄Sage、所在系Sdept五个属性组成。其中学号不能为空,值是唯一的,并且姓名取值也唯一。
CREATE TABLE Student
(Sno CHAR(5) NOT NULL UNIQUE,
Sname CHAR(20) UNIQUE,
Ssex CHAR(1) ,
Sage INT,
Sdept CHAR(15))
An Introduction to Database System
例:
Create table customer(
name char(20) not null,
street char(30),
city char(30),
primary key (name));
定义语句格式
An Introduction to Database System
例:
Create table branch(
name char(15)not null,
city char(30),
assets decimal ,
primary key (name),
check (assets>=0));
定义语句格式
An Introduction to Database System
Create table account (
branch_ number char(10),
branch_ name char*15),
branch_balance int ,
primary key(number),
foreign key (name)
reference branch(branch_name),
Check(balance>=0));
定义语句格式
An Introduction to Database System
Create table deposite (
customer_name char(20) not null,
account_ number char(10)not null,
primary key(customer_name,account_number),
foreign key(customer_name)reference customer(customer_name),
foreign key(account_number)
reference account(account_number));
外码可以定义多次,建立关系表之间的联系
定义语句格式
An Introduction to Database System
[例2] 建立一个“学生选课”表SC,它由学号Sno、o,修课成绩Grade组成,其中(Sno, Cno)为主码。
Create table sc( sno char(5) ,
cno char(3) ,
grade int,
Primary key (Sno, Cno)

2016-2017学年度高中物理 第八章 气体章末整合提升课件 新人教版选修3-3 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数11
  • 收藏数0 收藏
  • 顶次数0
  • 上传人changjinlai
  • 文件大小14.41 MB
  • 时间2018-04-24