当前位置:网站首页>【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;
边栏推荐
- 3. C language uses algebraic cofactor to calculate determinant
- 编写程序,模拟现实生活中的交通信号灯。
- 7. Relationship between array, pointer and array
- [hand tearing code] single case mode and producer / consumer mode
- 2. Preliminary exercises of C language (2)
- 【九阳神功】2018复旦大学应用统计真题+解析
- 2.初识C语言(2)
- 【VMware异常问题】问题分析&解决办法
- MySQL中count(*)的实现方式
- C language to achieve mine sweeping game (full version)
猜你喜欢

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

优先队列PriorityQueue (大根堆/小根堆/TopK问题)

4. Binary search

Mortal immortal cultivation pointer-2

这次,彻底搞清楚MySQL索引

7-7 7003 组合锁(PTA程序设计)

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

甲、乙机之间采用方式 1 双向串行通信,具体要求如下: (1)甲机的 k1 按键可通过串行口控制乙机的 LEDI 点亮、LED2 灭,甲机的 k2 按键控制 乙机的 LED1

2. Preliminary exercises of C language (2)

C语言入门指南
随机推荐
7-7 7003 组合锁(PTA程序设计)
实验六 继承和多态
2022 Teddy cup data mining challenge question C idea and post game summary
String ABC = new string ("ABC"), how many objects are created
Brief introduction to XHR - basic use of XHR
为什么要使用Redis
【九阳神功】2018复旦大学应用统计真题+解析
SRC挖掘思路及方法
Leetcode. 3. Longest substring without repeated characters - more than 100% solution
TypeScript快速入门
[the Nine Yang Manual] 2020 Fudan University Applied Statistics real problem + analysis
Programme de jeu de cartes - confrontation homme - machine
Miscellaneous talk on May 14
Mode 1 two-way serial communication is adopted between machine a and machine B, and the specific requirements are as follows: (1) the K1 key of machine a can control the ledi of machine B to turn on a
Safe driving skills on ice and snow roads
Cookie和Session的区别
实验七 常用类的使用
5. Download and use of MSDN
(原创)制作一个采用 LCD1602 显示的电子钟,在 LCD 上显示当前的时间。显示格式为“时时:分分:秒秒”。设有 4 个功能键k1~k4,功能如下:(1)k1——进入时间修改。
附加简化版示例数据库到SqlServer数据库实例中