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())
相關文章
- 【Mongo】MongoDB索引管理-索引的建立、檢視、刪除MongoDB索引
- mysql 建立和刪除聯合索引MySql索引
- mysql建立字首索引MySql索引
- MySQL索引建立原則MySql索引
- mongodb 如何檢視索引MongoDB索引
- MySQL-08.索引的建立和設計原則MySql索引
- mongodb建立索引和刪除索引和背景索引backgroundMongoDB索引
- Laravel 通過遷移指令碼建立MySQL檢視Laravel指令碼MySql
- Laravel 透過遷移指令碼建立MySQL檢視Laravel指令碼MySql
- MySQL 字串索引和字首索引MySql字串索引
- Mysql索引的建立與刪除MySql索引
- MYSQL 檢視MySql
- MySQL如何建立一個好索引?建立索引的5條建議【宇哥帶你玩轉MySQL 索引篇(三)】MySql索引
- MySQL 唯一索引和普通索引MySql索引
- 檢視錶和索引碎片情況相關資訊索引
- [20180503]檢視提示使用索引.txt索引
- MySQL View 檢視MySqlView
- MySQL 聚簇索引 和覆蓋索引MySql索引
- MySQL建立表的時候建立聯合索引的方法MySql索引
- 2020重新出發,MySql基礎,MySql檢視&索引&儲存過程&觸發器MySql索引儲存過程觸發器
- MySQL管理表和索引MySql索引
- Mysql多列索引建立與優化.mdMySql索引優化
- MySQL檢視和修改字符集的方法MySql
- 《MySQL 基礎篇》八:約束和檢視MySql
- MySQL檢視介紹MySql
- 管理mysql的檢視MySql
- MySQL 檢視簡介MySql
- 10_MySQL檢視MySql
- MySQL 的索引型別及如何建立維護MySql索引型別
- MySQL 的索引和事務MySql索引
- 2020.9.28(Hive檢視、索引、許可權管理)Hive索引
- 資料庫檢視,索引,觸發器資料庫索引觸發器
- Git檢視分支建立時間Git
- Python高階 -- 09 MySQL高階之事務、檢視、索引、賬戶管理、主從配置PythonMySql索引
- MySQL入門系列:檢視MySql
- MySql 什麼是檢視MySql
- MySQL之檢視學習MySql
- MySQL筆記 13 檢視MySql筆記