例题(续) SI no Sname Ssex Sage Sde pt 字符型字符型字符型整数字符型 长度为5长度为20长度为1 长度为15 不能为空值 An Introduction to Database System
An Introduction to Database System 例题 (续) Sno Sname Ssex Sage Sdept ↑ ↑ ↑ ↑ ↑ 字符型 字符型 字符型 整数 字符型 长度为5 长度为 20 长度为1 长度为 15 不能为空值
三、删除基本表 DROP TABLE<表名> 基本表删除数据、表上的索引都删除 表上的视图往往仍然保留, 但 无法引用 删除基本表时,系统会从数据字典中删去有关该 基本表及其索引的描述 (标准中没有,认为表建立后就永久存在) An Introduction to Database System
An Introduction to Database System 三、删除基本表 DROP TABLE <表名>; 基本表删除 数据、表上的索引都删除 表上的视图往往仍然保留, 但 无法引用 删除基本表时,系统会从数据字典中删去有关该 基本表及其索引的描述 (标准中没有,认为表建立后就永久存在)
例题 [例5]删除 Student表 DROP TABLE Student An Introduction to Database System
An Introduction to Database System 例题 [例5] 删除Student表 DROP TABLE Student ;
二、修改基本表 ALTER TABLE<表名> [ADD<新列名><数据类型>[完整性约束]] [DROP<完整性约束名>] [ MODIFY<列名><数据类型>] ■<表名>:要修改的基本表 ADD子句:增加新列和新的完整性约束条件 ■DROP子句:删除指定的完整性约束条件 MODIFY子句:用于修改列名和数据类型 An Introduction to Database System
An Introduction to Database System 二、修改基本表 ALTER TABLE <表名> [ ADD <新列名> <数据类型> [ 完整性约束 ] ] [ DROP <完整性约束名> ] [ MODIFY <列名> <数据类型> ]; ◼ <表名>:要修改的基本表 ◼ ADD子句:增加新列和新的完整性约束条件 ◼ DROP子句:删除指定的完整性约束条件 ◼ MODIFY子句:用于修改列名和数据类型
例题 [例2]向 Student表增加“入学时间”列,其数 据类型为日期型。 ALTER TABLE Student add scome date 不论基本表中原来是否已有数据,新增加的列一律 为空值 An Introduction to Database Syst
An Introduction to Database System 例题 [例2] 向Student表增加“入学时间”列,其数 据类型为日期型。 ALTER TABLE Student ADD Scome DATE; ◼ 不论基本表中原来是否已有数据,新增加的列一律 为空值