当前位置:网站首页>[experiment index of educator database]

[experiment index of educator database]

2022-07-06 13:53:00 Fu Ying ('▿')

1、 Mission requirements

stay sale In the database , Establish supplier data sheet
gys, Including supplier name gysh Character 4 position 、 Corporate name Variable length character type 20 position 、 Telephone Variable length character type 11 position 、 Address Variable length character type 20 position 、 Contacts Variable length character type 4 position 、 mobile phone Character 11 position Field , At the same time, the main index is established according to the supplier number field .
Display in rows gyh Index of data table

use sale;
 # Code start 
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;
 # Code end 

2、 Mission :
The first question is
stay xsdmx The data sheet is numbered according to the sales order xsdh And serial number xh Two fields establish the primary index xsdxh
The second question is
stay xsdmx The data sheet is based on the commodity number sph Field to build a general index sphsy.
Third question
In commodities sp The data sheet is based on the trade name spm Field to establish a unique index spmsy.

use sale
 # Code start 
 # The first question is 
alter table xsdmx add primary key(xsdh,xh);
 # The second question is 
 create index sphsy on xsdmx(sph);
 # Third question 
 create unique index spmsy on sp(spm);
 # Code end 
 show index in xsdmx\g;
 show index in sp\g;

3、 Delete sp Index of commodity data sheet spmsy
      The command format of deleting the index

use sale;
# Code start 
alter table sp drop index spmsy;
# Code end 
show index in sp\g;

原网站

版权声明
本文为[Fu Ying ('▿')]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060917206605.html