MySQL
文章平均质量分 76
davyjones2010
生活在这个世界而不知其义,如同徜徉于一座伟大的图书馆而不碰书籍。
展开
-
MySQL: Group By
1. Group By 1) GroupBy Is usually used with aggragation function(statistic function). If not, group by is pointless. 2) Five aggragation function: 1) max 2) min ...原创 2013-04-09 00:01:13 · 84 阅读 · 0 评论 -
MySQL: What is Store Engine
1. Introduction 1) Take a movie for example. We have different format of it including mp4, avi, rmvb, flv. And different format occupy different space in hard disk, and resolution differs. ...原创 2013-04-28 10:47:55 · 159 阅读 · 0 评论 -
MySQL: Trigger (Part II)
1. Difference between Before and After in Trigger 1) After we perform one action, the trigger is invoked. But there is no machanism to check if the action we perform is reasonable.# Bootstrap ...原创 2013-04-25 22:38:19 · 164 阅读 · 0 评论 -
MySQL: Trigger (Part I)
Target: 1) Definition of Trigger 2) Circumstances of Using Trigger 3) Syntax for Creating Trigger 1. Definition of Trigger 1) Function: Observe one specific state change and ...原创 2013-04-24 23:22:05 · 135 阅读 · 0 评论 -
MySQL: Charset and Collation
1. Introduction 1) create table table_name (column_declaration) charset utf8; 2) set names gbk; Comments: 1) What's the meaning? 2) What's the difference? 2. Charset ...原创 2013-04-23 00:24:16 · 302 阅读 · 0 评论 -
MySQL: View
Why use View: 1) Sometimes the result set of a query is frequently used. That is this result set is usually used as a sub-query for another query. So why don't we transform this result set into...原创 2013-04-20 18:15:11 · 149 阅读 · 0 评论 -
MySQL: DDL ( Data Definition Language) for Column Management
1. Create tablecreate table table_name(column_name column_type [, column_attribute] [, column_default_value], --> Column Declarationcolumn_name column_type [, column_attribute] [, column_de...原创 2013-04-20 00:42:11 · 122 阅读 · 0 评论 -
MySQL: Left Join for More Than Two tables
1. Tables used# 1. goodsselect * from goods;+----------+--------+------------+----------+| goods_id | cat_id | goods_name | owner_id |+----------+--------+------------+----------+| ...原创 2013-04-19 23:55:16 · 110 阅读 · 0 评论 -
MySQL: Left Join, Right Join and Inner Join, Outer Join
Example to explain differences of left join and right join :#################select * from goods;+----------+--------+------------+| goods_id | cat_id | goods_name |+----------+--------+--...原创 2013-04-19 08:07:17 · 177 阅读 · 0 评论 -
MySQL: Cartesian Product and Left Join
1. Example as below: # 1. Goods tableselect * from goods;+----------+--------+------------+| goods_id | cat_id | goods_name |+----------+--------+------------+| 1 | 1 | CDMA...原创 2013-04-18 23:10:42 · 341 阅读 · 0 评论 -
MySQL: Union
1. Union 1) Function: Combine the result sets from two query into one single result set.# Single result set 1select * from stu where stu_score > 40;# Single result set 2select * fr...原创 2013-04-18 00:44:58 · 137 阅读 · 0 评论 -
MySQL: Where sub-query & From sub-query & Exists sub-query
1. A good comprehension model: 1) Where expression: Fit this experssion into every row and get the true/false result.#Where expression comprehension modelselect * from stu where stu_name = ...原创 2013-04-11 23:48:15 · 205 阅读 · 0 评论 -
MySQL: Basic Order by & Limit sub-clause
1. Using basic 'order by'# Order stu by stu_score as the order of descendantselect * from stu order by stu_score desc; 2. Using 'order by' to order multiple columns# Order table 'stu' by s...原创 2013-04-10 23:54:15 · 158 阅读 · 0 评论 -
MySQL: A small practice for where/group by/having/order by clause
# Here is an example for five sql caluse# Pay attention to the sequence of the four clause# select *** from *** where *** group by *** having *** order by *** limit ***select stu_name, avg(stu...原创 2013-04-09 23:53:41 · 119 阅读 · 0 评论 -
MySQL: Having
1. Eg. # Fetch the difference between shop_price and market_price, and list the goods whose difference is bigger than 200# The first partselect *, (market_price - shop_price) as difference...原创 2013-04-09 00:17:15 · 85 阅读 · 0 评论 -
MySQL: Transaction (Part I - Basic Concept)
1. What is transaction? ----> It is a sequence of operations that should be regard as a whole and cannot be split. One operation in the sequence failed, then all the operation should be rollb...原创 2013-05-08 23:56:53 · 157 阅读 · 0 评论