当前位置:网站首页>【educoder数据库实验 索引】
【educoder数据库实验 索引】
2022-07-06 09:22:00 【馥滢( '▿ ' )】
1、任务要求
在sale数据库中,建立供应商数据表
gys,包括供应商号gysh 字符型4位、公司名称 可变长字符型20位、电话 可变长字符型11位、地址 可变长字符型20位、联系人 可变长字符型4位、手机 字符型11位 字段,同时根据供应商号字段建立主索引。
按行的方式显示gyh数据表的索引
use sale;
#代码开始
create table gyh
(
gysh char(4) primary key,
Name varchar(20),
telephone varchar(11),
address varchar(20),
contact varchar(4),
mobile char(11)
);
show index from gyh;
#代码结束
2、任务:
第一题
在xsdmx数据表根据销售单编号xsdh和序号xh两个字段建立主索引xsdxh
第二题
在xsdmx数据表根据商品编号sph字段建立普通索引sphsy。
第三题
在商品sp数据表根据商品名spm字段建立唯一索引spmsy。
use sale
#代码开始
#第一题
alter table xsdmx add primary key(xsdh,xh);
#第二题
create index sphsy on xsdmx(sph);
#第三题
create unique index spmsy on sp(spm);
#代码结束
show index in xsdmx\g;
show index in sp\g;
3、删除sp商品数据表的索引spmsy
删除索引的命令格式
use sale;
#代码开始
alter table sp drop index spmsy;
#代码结束
show index in sp\g;
边栏推荐
- [the Nine Yang Manual] 2019 Fudan University Applied Statistics real problem + analysis
- Brief introduction to XHR - basic use of XHR
- 7-11 机工士姆斯塔迪奥(PTA程序设计)
- The latest tank battle 2022 - full development notes-3
- Thoroughly understand LRU algorithm - explain 146 questions in detail and eliminate LRU cache in redis
- 仿牛客技术博客项目常见问题及解答(三)
- 2. Preliminary exercises of C language (2)
- [中国近代史] 第六章测验
- C language Getting Started Guide
- 7-14 错误票据(PTA程序设计)
猜你喜欢
.Xmind文件如何上传金山文档共享在线编辑?
The difference between cookies and sessions
Relationship between hashcode() and equals()
fianl、finally、finalize三者的区别
C language Getting Started Guide
7-7 7003 组合锁(PTA程序设计)
C语言入门指南
[hand tearing code] single case mode and producer / consumer mode
Caching mechanism of leveldb
FAQs and answers to the imitation Niuke technology blog project (II)
随机推荐
FAQs and answers to the imitation Niuke technology blog project (I)
1. First knowledge of C language (1)
QT meta object qmetaobject indexofslot and other functions to obtain class methods attention
【VMware异常问题】问题分析&解决办法
. Net6: develop modern 3D industrial software based on WPF (2)
[the Nine Yang Manual] 2018 Fudan University Applied Statistics real problem + analysis
[the Nine Yang Manual] 2021 Fudan University Applied Statistics real problem + analysis
C语言入门指南
2022 Teddy cup data mining challenge question C idea and post game summary
4. Branch statements and loop statements
1. C language matrix addition and subtraction method
5. Download and use of MSDN
Mortal immortal cultivation pointer-1
Detailed explanation of redis' distributed lock principle
重载和重写的区别
【九阳神功】2020复旦大学应用统计真题+解析
【头歌educoder数据表中数据的插入、修改和删除】
C language to achieve mine sweeping game (full version)
5. Function recursion exercise
简单理解ES6的Promise