create [unique|fulltext|spatial] index index_name [using index_type] on tbl_name(index_col_name, ...); index_col_name: col_name [(length)] [asc/desc]
ALTER [IGNORE] TABLE tbl_name alter_specification [, alter_specification] ... alter_specification: ... ADD INDEX [index_name] [index_type] (index_col_name,...) ...
mysql> create index cityName on city(Name(10)); mysql> alter table city add index cityName(Name(10));
drop index index_name on tbl_name;
create [or replace][algorithm = {undefined|merge|temptable}]
view view_name[(column_list)]
as select_statement
[with [cascade|local] check option]
alter [algorithm = {undefined|merge|temptable}]
view view_name[(column_list)]
as select_statement
[with [cascade|local] check option]
-- 包含聚合函数 mysql > create or replace view payment_sum as -> select staff_id,sum(amount) -> from payment -> group by staff_id; -- 常量视图 mysql > create or replace view pi as -> select 3.1415926 as pi; -- select中包含子查询 mysql > create view city_view as -> select ( select city from city where city_id = 1);
drop view [if exists] view_name [,view_name] ... [restrict|cascaded]
mysql> drop view pay_view1,pay_view2; Query OK, 0 rows affected (0.00 sec)
show table status [from db_name] [like 'pattern']
mysql> show table status like 'pay_view' \G *************************** 1. row *************************** Name: pay_view Engine: NULL Version: NULL Row_format: NULL Rows: NULL Avg_row_length: NULL Data_length: NULL Max_data_length: NULL Index_length: NULL Data_free: NULL Auto_increment: NULL Create_time: NULL Update_time: NULL Check_time: NULL Collation: NULL Checksum: NULL Create_options: NULL Comment: VIEW 1 row in set (0.00 sec)
mysql> show create view pay_view \G *************************** 1. row *************************** View: pay_view Create View: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `pay_view` AS select `pay`.`pid` AS `pid`,`pay`.`amount` AS `amount` from `pay` where (`pay`.`amount` < 10) WITH CASCADED CHECK OPTION character_set_client: gbk collation_connection: gbk_chinese_ci 1 row in set (0.00 sec)
mysql> select * from information_schema.views where table_name = 'pay_view' \G *************************** 1. row *************************** TABLE_CATALOG: def TABLE_SCHEMA: mysqldemo TABLE_NAME: pay_view VIEW_DEFINITION: select `mysqldemo`.`pay`.`pid` AS `pid`,`mysqldemo`.`pay`.`amount` AS `amount` from `mysqldemo`.`pay` where (`mysqldemo`.`pay`.`amount` < 10) CHECK_OPTION: CASCADED IS_UPDATABLE: YES DEFINER: root@localhost SECURITY_TYPE: DEFINER CHARACTER_SET_CLIENT: gbk COLLATION_CONNECTION: gbk_chinese_ci 1 row in set (0.03 sec)
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有