当前位置:网站首页>【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;
边栏推荐
- 7-3 构造散列表(PTA程序设计)
- String abc = new String(“abc“),到底创建了几个对象
- [modern Chinese history] Chapter 9 test
- Poker game program - man machine confrontation
- Caching mechanism of leveldb
- 【黑马早报】上海市监局回应钟薛高烧不化;麦趣尔承认两批次纯牛奶不合格;微信内测一个手机可注册俩号;度小满回应存款变理财产品...
- hashCode()与equals()之间的关系
- Nuxtjs quick start (nuxt2)
- Difference and understanding between detected and non detected anomalies
- It's never too late to start. The tramp transformation programmer has an annual salary of more than 700000 yuan
猜你喜欢

About the parental delegation mechanism and the process of class loading

The latest tank battle 2022 - Notes on the whole development -2

MySQL lock summary (comprehensive and concise + graphic explanation)

这次,彻底搞清楚MySQL索引

自定义RPC项目——常见问题及详解(注册中心)

1. First knowledge of C language (1)

1. C language matrix addition and subtraction method

透彻理解LRU算法——详解力扣146题及Redis中LRU缓存淘汰

PriorityQueue (large root heap / small root heap /topk problem)

Caching mechanism of leveldb
随机推荐
Have you encountered ABA problems? Let's talk about the following in detail, how to avoid ABA problems
Reinforcement learning series (I): basic principles and concepts
[中国近代史] 第五章测验
Caching mechanism of leveldb
C语言入门指南
8. C language - bit operator and displacement operator
3. Number guessing game
3.输入和输出函数(printf、scanf、getchar和putchar)
7-5 走楼梯升级版(PTA程序设计)
js判断对象是否是数组的几种方式
7. Relationship between array, pointer and array
2. First knowledge of C language (2)
深度强化文献阅读系列(一):Courier routing and assignment for food delivery service using reinforcement learning
3. C language uses algebraic cofactor to calculate determinant
C language Getting Started Guide
Detailed explanation of redis' distributed lock principle
扑克牌游戏程序——人机对抗
[the Nine Yang Manual] 2020 Fudan University Applied Statistics real problem + analysis
记一次猫舍由外到内的渗透撞库操作提取-flag
实验七 常用类的使用