mysql建立索引和檢視
索引建立:
1.選表,設計表,選擇欄位
2.建檢視:
新建檢視,寫檢視程式碼
select `parkingmessage`.`id` AS `id`,`parkingmessage`.`version` AS `version`,`parkingmessage`.`sname` AS `sname`,`parkingmessage`.`iddep` AS `iddep`,`parkingmessage`.`idowner` AS `idowner`,`parkingmessage`.`createdby` AS `createdby`,`parkingmessage`.`created` AS `created`,`parkingmessage`.`updatedby` AS `updatedby`,`parkingmessage`.`updated` AS `updated`,`parkingmessage`.`starttime` AS `starttime`,`parkingmessage`.`endtime` AS `endtime`,`parkingmessage`.`platenumber` AS `platenumber`,`parkingmessage`.`parkinglotbelong` AS `parkinglotbelong`,`parkingmessage`.`parkingtime` AS `parkingtime`,`parkingmessage`.`paymentstate` AS `paymentstate`,`parkingmessage`.`paymenttype` AS `paymenttype`,`parkingmessage`.`note` AS `note`,`parkingmessage`.`platephoto` AS `platephoto`,`parkingmessage`.`platephoto_title` AS `platephoto_title`,`parkingmessage`.`parkingspace` AS `parkingspace`,(case when isnull(`parkingmessage`.`endtime`) then `calc_fee`(`parkingmessage`.`parkinglotbelong`,`parkingmessage`.`cartype`,`parkingmessage`.`starttime`) else `parkingmessage`.`parkingfee` end) AS `parkingfee`,`parkingmessage`.`ordernum` AS `ordernum`,`parkingmessage`.`parkingphoto` AS `parkingphoto`,`parkingmessage`.`parkingphoto_title` AS `parkingphoto_title`,`parkingmessage`.`lcfs` AS `lcfs`,`parkingmessage`.`parkarea` AS `parkarea`,`parkingmessage`.`parkstate` AS `parkstate`,`parkingmessage`.`parkuserbelong` AS `parkuserbelong`,`parkingmessage`.`idbook` AS `idbook`,`parkingmessage`.`address` AS `address`,`parkingmessage`.`booktime` AS `booktime`,`parkingmessage`.`isbook` AS `isbook`,`parkingmessage`.`paytime` AS `paytime`,`parkingmessage`.`prepay` AS `prepay`,`parkingmessage`.`cartype` AS `cartype`,`parkingmessage`.`qrcode` AS `qrcode`,`parkingmessage`.`prepaytime` AS `prepaytime`,`parkingmessage`.`payfee` AS `payfee`,`parkingmessage`.`backfee` AS `backfee`,`parkingmessage`.`supplementaryfee` AS `supplementaryfee`,`parkingmessage`.`supplementarytime` AS `supplementarytime`,`parkingmessage`.`pushtoken` AS `pushtoken`,`parkingmessage`.`maninput` AS `maninput` from `parkingmessage` where ((`parkingmessage`.`endtime` > curdate()) or isnull(`parkingmessage`.`endtime`)) union all select `hparkingmessage`.`id` AS `id`,`hparkingmessage`.`version` AS `version`,`hparkingmessage`.`sname` AS `sname`,`hparkingmessage`.`iddep` AS `iddep`,`hparkingmessage`.`idowner` AS `idowner`,`hparkingmessage`.`createdby` AS `createdby`,`hparkingmessage`.`created` AS `created`,`hparkingmessage`.`updatedby` AS `updatedby`,`hparkingmessage`.`updated` AS `updated`,`hparkingmessage`.`starttime` AS `starttime`,`hparkingmessage`.`endtime` AS `endtime`,`hparkingmessage`.`platenumber` AS `platenumber`,`hparkingmessage`.`parkinglotbelong` AS `parkinglotbelong`,`hparkingmessage`.`parkingtime` AS `parkingtime`,`hparkingmessage`.`paymentstate` AS `paymentstate`,`hparkingmessage`.`paymenttype` AS `paymenttype`,`hparkingmessage`.`note` AS `note`,`hparkingmessage`.`platephoto` AS `platephoto`,`hparkingmessage`.`platephoto_title` AS `platephoto_title`,`hparkingmessage`.`parkingspace` AS `parkingspace`,`hparkingmessage`.`parkingfee` AS `parkingfee`,`hparkingmessage`.`ordernum` AS `ordernum`,`hparkingmessage`.`parkingphoto` AS `parkingphoto`,`hparkingmessage`.`parkingphoto_title` AS `parkingphoto_title`,`hparkingmessage`.`lcfs` AS `lcfs`,`hparkingmessage`.`parkarea` AS `parkarea`,`hparkingmessage`.`parkstate` AS `parkstate`,`hparkingmessage`.`parkuserbelong` AS `parkuserbelong`,`hparkingmessage`.`idbook` AS `idbook`,`hparkingmessage`.`address` AS `address`,`hparkingmessage`.`booktime` AS `booktime`,`hparkingmessage`.`isbook` AS `isbook`,`hparkingmessage`.`paytime` AS `paytime`,`hparkingmessage`.`prepay` AS `prepay`,`hparkingmessage`.`cartype` AS `cartype`,`hparkingmessage`.`qrcode` AS `qrcode`,`hparkingmessage`.`prepaytime` AS `prepaytime`,`hparkingmessage`.`payfee` AS `payfee`,`hparkingmessage`.`backfee` AS `backfee`,`hparkingmessage`.`supplementaryfee` AS `supplementaryfee`,`hparkingmessage`.`supplementarytime` AS `supplementarytime`,`hparkingmessage`.`pushtoken` AS `pushtoken`,`hparkingmessage`.`maninput` AS `maninput` from `hparkingmessage` where (`hparkingmessage`.`endtime` > curdate())
相關文章
- mysql 建立索引的方法--建立檢視MySql索引
- mysql檢視錶建立的索引MySql索引
- mysql 檢視索引MySql索引
- MySQL 建立檢視MySql
- 【Mongo】MongoDB索引管理-索引的建立、檢視、刪除MongoDB索引
- MySQL資料庫檢視:檢視定義、建立檢視、修改檢視MySql資料庫
- 語法檢視錶結構,索引mysql索引MySql
- mysql 建立和刪除聯合索引MySql索引
- mysql建立字首索引MySql索引
- 全面學習MySQL中的檢視(2) 指定檢視建立者MySql
- MySQL 5.5建立和檢視資料庫計劃任務(event)MySql資料庫
- MySQL建立複合索引MySql索引
- MySQL索引建立原則MySql索引
- mongodb 如何檢視索引MongoDB索引
- 使用index_stats檢視檢視索引效率Index索引
- MySQL-08.索引的建立和設計原則MySql索引
- mongodb建立索引和刪除索引和背景索引backgroundMongoDB索引
- Laravel 透過遷移指令碼建立MySQL檢視Laravel指令碼MySql
- Laravel 通過遷移指令碼建立MySQL檢視Laravel指令碼MySql
- 建立檢視和淺析LOCAL INDEX和GLOBAL INDEXIndex
- MySQL建立索引、修改索引、刪除索引的命令語句MySql索引
- MYSQL 檢視MySql
- Mysql檢視:MySql
- MySQL 字串索引和字首索引MySql字串索引
- Mysql索引的建立與刪除MySql索引
- oracle 建立物化檢視Oracle
- Oracle 物化檢視建立Oracle
- MySQL如何建立一個好索引?建立索引的5條建議【宇哥帶你玩轉MySQL 索引篇(三)】MySql索引
- 檢視錶、檢視、索引、儲存過程和觸發器的定義的方法索引儲存過程觸發器
- 檢視mysql表大小和記錄數MySql
- 物化檢視上使用bitmap索引索引
- MySQL 唯一索引和普通索引MySql索引
- Mysql檢視程式MySql
- Mysql版本檢視MySql
- MySQL View 檢視MySqlView
- 自定義例外 + 建立檢視
- 動態建立ImageView檢視View
- 【原創】匯出所有物件(表、索引、檢視、同義詞)的建立指令碼物件索引指令碼