当前位置:网站首页>【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;
边栏推荐
- 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
- [modern Chinese history] Chapter V test
- MySQL lock summary (comprehensive and concise + graphic explanation)
- 7-4 散列表查找(PTA程序设计)
- 简述xhr -xhr的基本使用
- Cookie和Session的区别
- Why use redis
- The latest tank battle 2022 full development notes-1
- [中国近代史] 第五章测验
- 透彻理解LRU算法——详解力扣146题及Redis中LRU缓存淘汰
猜你喜欢
![[面試時]——我如何講清楚TCP實現可靠傳輸的機制](/img/d6/109042b77de2f3cfbf866b24e89a45.png)
[面試時]——我如何講清楚TCP實現可靠傳輸的機制

.Xmind文件如何上传金山文档共享在线编辑?

Leetcode. 3. Longest substring without repeated characters - more than 100% solution

C language to achieve mine sweeping game (full version)

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

1. Preliminary exercises of C language (1)

Nuxtjs快速上手(Nuxt2)

A comprehensive summary of MySQL transactions and implementation principles, and no longer have to worry about interviews

附加简化版示例数据库到SqlServer数据库实例中

Service ability of Hongmeng harmonyos learning notes to realize cross end communication
随机推荐
[the Nine Yang Manual] 2021 Fudan University Applied Statistics real problem + analysis
仿牛客技术博客项目常见问题及解答(三)
5. Function recursion exercise
Wechat applet
稻 城 亚 丁
3. Input and output functions (printf, scanf, getchar and putchar)
【毕业季·进击的技术er】再见了,我的学生时代
7-3 构造散列表(PTA程序设计)
SRC挖掘思路及方法
[the Nine Yang Manual] 2017 Fudan University Applied Statistics real problem + analysis
Custom RPC project - frequently asked questions and explanations (Registration Center)
String abc = new String(“abc“),到底创建了几个对象
[the Nine Yang Manual] 2020 Fudan University Applied Statistics real problem + analysis
Detailed explanation of redis' distributed lock principle
[中国近代史] 第六章测验
7-8 7104 约瑟夫问题(PTA程序设计)
A piece of music composed by buzzer (Chengdu)
附加简化版示例数据库到SqlServer数据库实例中
Mortal immortal cultivation pointer-1
(original) make an electronic clock with LCD1602 display to display the current time on the LCD. The display format is "hour: minute: Second: second". There are four function keys K1 ~ K4, and the fun