当前位置:网站首页>【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;
边栏推荐
- Service ability of Hongmeng harmonyos learning notes to realize cross end communication
- 7-8 7104 约瑟夫问题(PTA程序设计)
- 9. Pointer (upper)
- 【手撕代码】单例模式及生产者/消费者模式
- Mortal immortal cultivation pointer-1
- Wei Pai: the product is applauded, but why is the sales volume still frustrated
- 3. C language uses algebraic cofactor to calculate determinant
- 3.输入和输出函数(printf、scanf、getchar和putchar)
- C language Getting Started Guide
- 为什么要使用Redis
猜你喜欢
随机推荐
Using qcommonstyle to draw custom form parts
It's never too late to start. The tramp transformation programmer has an annual salary of more than 700000 yuan
Difference and understanding between detected and non detected anomalies
4. Binary search
[the Nine Yang Manual] 2021 Fudan University Applied Statistics real problem + analysis
实验四 数组
[the Nine Yang Manual] 2016 Fudan University Applied Statistics real problem + analysis
The latest tank battle 2022 - full development notes-3
Read only error handling
记一次猫舍由外到内的渗透撞库操作提取-flag
Reinforcement learning series (I): basic principles and concepts
Have you encountered ABA problems? Let's talk about the following in detail, how to avoid ABA problems
ABA问题遇到过吗,详细说以下,如何避免ABA问题
FAQs and answers to the imitation Niuke technology blog project (III)
一段用蜂鸣器编的音乐(成都)
[dark horse morning post] Shanghai Municipal Bureau of supervision responded that Zhong Xue had a high fever and did not melt; Michael admitted that two batches of pure milk were unqualified; Wechat i
附加简化版示例数据库到SqlServer数据库实例中
7-9 制作门牌号3.0(PTA程序设计)
FAQs and answers to the imitation Niuke technology blog project (I)
Poker game program - man machine confrontation









