当前位置:网站首页>【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;
边栏推荐
- 2. C language matrix multiplication
- [the Nine Yang Manual] 2022 Fudan University Applied Statistics real problem + analysis
- Differences among fianl, finally, and finalize
- canvas基础2 - arc - 画弧线
- [hand tearing code] single case mode and producer / consumer mode
- FAQs and answers to the imitation Niuke technology blog project (II)
- 5月14日杂谈
- 【九阳神功】2021复旦大学应用统计真题+解析
- 受检异常和非受检异常的区别和理解
- 实验六 继承和多态
猜你喜欢

Reinforcement learning series (I): basic principles and concepts

1. C language matrix addition and subtraction method

撲克牌遊戲程序——人機對抗

Change vs theme and set background picture

Using spacedesk to realize any device in the LAN as a computer expansion screen

Mortal immortal cultivation pointer-2

关于双亲委派机制和类加载的过程

【VMware异常问题】问题分析&解决办法

1. Preliminary exercises of C language (1)

C language Getting Started Guide
随机推荐
Implementation of count (*) in MySQL
canvas基础1 - 画直线(通俗易懂)
Wei Pai: the product is applauded, but why is the sales volume still frustrated
简单理解ES6的Promise
Service ability of Hongmeng harmonyos learning notes to realize cross end communication
This time, thoroughly understand the MySQL index
7-11 机工士姆斯塔迪奥(PTA程序设计)
使用Spacedesk实现局域网内任意设备作为电脑拓展屏
js判断对象是否是数组的几种方式
Beautified table style
Caching mechanism of leveldb
附加简化版示例数据库到SqlServer数据库实例中
7-15 h0161. 求最大公约数和最小公倍数(PTA程序设计)
[graduation season · advanced technology Er] goodbye, my student days
The latest tank battle 2022 - full development notes-3
TypeScript快速入门
A piece of music composed by buzzer (Chengdu)
强化学习系列(一):基本原理和概念
String abc = new String(“abc“),到底创建了几个对象
甲、乙机之间采用方式 1 双向串行通信,具体要求如下: (1)甲机的 k1 按键可通过串行口控制乙机的 LEDI 点亮、LED2 灭,甲机的 k2 按键控制 乙机的 LED1