竹磬网-邵珠庆の日记 生命只有一次,你可以用它来做些更多伟大的事情–Make the world a little better and easier


256月/150

每个人大脑中的目标

发布在 邵珠庆

我们的大脑就像一个装满蜜蜂的沙滩球,数百种不同的力量让我们前往不同的方向。

人们绝不会专心于一件事,我们总是想去完成所有事情。

我们想去锻炼的同时又想去学西班牙语,又想出去吃披萨。

欲望是无穷无尽的,这些不受约束欲望,总在把这个球推向他们想要的方向。

但是通常来说,那个球哪也去不了。它里面的着这些欲望没起到什么作用,而关键却在于地形。

这是大多数人度过人生的方式,这些欲望在无休止地冲突,我们永远没有足够的时间去实现。

结果就是我们没有能力去战胜面对的困难。

让我们来解决一下吧!

好点子的诅咒

想象一下,假如20年以前,你是一个同时有开创google,facebook,amazon企业想法的天才。

你刚刚有了上个世纪三个最佳的商业想法,如果你开办了其中一家,你现在身价就是数十亿美元了。

但如果你决定同时开创这三家企业,你绝对会毫无结果,默默无名。

有好的点子还不够,很多人有好的点子,问题在于太多这些想法在一起,就会相互抵消了。

这也是为什么一群由聪明人组成的委员会被叫做傻瓜,领导力不是按人数来计算的。

你想去越多的方向,你前行的距离就会越短。

人们怎么实现不可能呢?

替你自己想一个疯狂雄心勃勃的目标吧。例如要写一本书,或者要登上火星。

如果你真的想实现这个目标,如果你的生活还有你关爱的人们的生活都取决于它,你会怎么去做呢?你能怎么做呢?你只能把其它的一切都放在一边,变成一个大黄蜂,朝一个方向努力,你会移动地非常非常快。

偏执狂只专注于一个目标,这大概是最终成功的策略吧。

这是一个从每个成功人士身上都能发现的一个模式,无论爱迪生还是爱因斯坦。

当你能连续地专注于一个目标时,你的成就就能取得它们理论上的极限。

大多数人并不是因为他们的潜能多少而失败,而是因为把他们的潜能都分散在太多的方向了。

怎么去驯服这个蜂群呢
你总是想实现更多的目标,但遗憾的的是想去很多方向是让自己失败最快的方式,而专注于一个方向却是一个最快能确保你成功的方式。

所以尝试一下这个:

  1. 定大志。如果你的抱负都很小,那么很容易就能实现了,然而高远的志向反而会让你去坚持,因为你会把周围的小目标都忽略了。
  2. 在三个方面设立目标。为你生活的不同方面列三个清单,比如说“工作”’、”家“,”周末“。每份清单都设立一个目标,如果你想要添加更多目标,你必须知道目标越多,实现的可能性却越小。
  3. 学会推迟。任何不是最重要的事情,都最好放到后面去做。马克-扎克伯格很聪明地先去开创了facebook,然后去学中文。你的目标也一样,只是你通常太过于专注太多目标。
  4. 小心你的虚妄之想。要注意你的这些想法,虽然看起来都是很美妙,有益的,但它们却都是致命的。记住,每增加一个目标,都会减缓你完成其其它目标的速度。

集齐你的大黄蜂。你可能不会同时创立下一个google,发明治愈癌症的妙药,登陆火星。但是你可能可以同时成为一个成功健壮的CEO。成功和健康是可以互补的目标:一个更健康的人可以成为一个更优秀的领导。它们就像是两个大黄蜂,朝着同一个方向,加力向前推进。

那些成就一番伟业,用一生来改变世界的人绝不会分散他们的目标。他们都有大志,把大黄蜂都集齐在一起,奋力向前,拒绝生活当中的其它机会。

如果你想要有力量追求你的梦想,你必须拒绝其它的小目标。这并不容易,但至少对你来说,你知道要付出的代价。

256月/150

How do I find my passion?- 怎样获得激情?

发布在 邵珠庆

原文是Oliver Emberton在Quora的一个问题——How do I find my passion?下的回答。现本着学习交流的目的,将其翻译如下,欢迎指正。

Too many of us believe in a magical being called ‘passion’. “If only I could find my passion”, we cry. “Finding my passion would make me happy”.
人们总会相信一个神奇的词:激情。“只要能找到自己的激情在什么上,我一定会快乐起来!”

 

Well, passion is real, and very powerful. But almost everything people believe about finding it is wrong.
确实,激情有这个能力;但怎么寻找激情引发点,人们却总是不得其法。
Rule 1: Passion comes from success1. 激情源自成功
All of our emotions exist for good reason. We feel hunger to ensure we don’t starve. We feel full to ensure we don’t burst. And we feel passion to ensure we concentrate our efforts on things that reward us the most.
我们所有情绪的存在,都是有原因的。我们会感觉到饥饿,才不会饿死;会感觉到饱,才不会撑死(也有例外)。而我们的激情,是驱使自己把更多的精力,花在能给我们最大回报的事情上。
Imagine you start a dance class. You find it easy. You realise you’re getting better than others, and fast. That rising excitement you feel is your passion, and that passion makes you come back for more, improving your skills, and compounding your strengths.
比如你开始上舞蹈班时,发现很轻松,你比别人做的更好,学得更快。这就会让你觉得兴奋,也就是传说中的激情,激情会让你花更多的心思去学习,去进步。

 

The enemy of passion is frustration. If you constantly struggle with something, you’ll never become passionate about it. You learn to avoid it entirely, guaranteeing you never improve.
而激情的敌人,是沮丧。如果某件事对你来说简直就是挣扎,你是不会对它有激情的。避免沮丧,否则你是很难提高的。

 

Most people get this backwards. They think we discover our passion, and that makes us good at something. It’s actually finding that you’re good which comes first. Passion comes from success.
反馈机制如上图,大多人是这种情况。他们觉得,我得先发现激情所在,然后才能获得成功;但实际上,成功是激情之母。
Rule 2: Childhood is where passion goes to die2. 激情卒于童年
In theory childhood provides a great opportunity to try a bit of everything, find your talents, and with them, your passions.
理论上,童年时的我们,会有很多机会涉猎各种事情,通过这种方式,我们会发现自己的天赋,发现自己的激情。
But think for a moment how badly the system is stacked against you. Say school lets you try 20 subjects, ranking you against thousands of other children. Those aren’t good odds. Most kids are, by definition, around average. And it doesn’t matter how much we improve education, because people need to feel exceptional to feel passionate, and improving education simply moves up the average.
但想一想,我们就会发现,在这个系统中,我们只是可怜的路人甲。比如,学校里你需要选20门课,但需要和数千名小伙伴们一起排名。这可就不好玩了。大多数孩子都是普通水平——因为普通的定义就是大多数所达到的水平。这样,即使教育水平提高,也无济于事,以为我们需要从独特的优越中获取激情,而教育提高的是一群人的水平,水涨船高。

 

Say you’re one of the lucky ones, and you’re top of your junior math class. The education system will keep rising your difficulty until you find a level – like college – where you’re not exceptional anymore. Even if you actually are objectively pretty great, once you feel merely average, you’ll find your passion slipping.
再假如,你很幸运地成为了传说中的万里挑一,是你们整个八年级数学最好的那个。随着你接受的教育越来越高端,难度越来越大,总一天你会发现自己不再出色——高等数学课上,你已经泯然众人矣。即使你真的很强,又读到数学博士,但发现自己只是个“普通的”数学博士,你的热情,就像一把渐渐熄灭的火。
And that’s if you’re lucky. What if your passion was for art? From an early age that passion is compromised by its social consequences. “It’s hard to make a living from painting” say your parents. “Your cousin is doing so well from engineering. Why can’t you be more like him?” And so you put your passions to one side, and let them wither.
这还算是幸运的。如果你的激情在艺术上会怎样?你激情的小火苗还没燃起来的时候,它就已经被看衰。你爸妈会说,画画很难吃饱饭的,那谁家的谁谁,学机械工程好就业,你就不学好?于是你不得不放下你的音乐/艺术梦想,任其枯萎。
In a population of billions, it’s obvious that not everyone can be unusually great at a handful of academic subjects. What if your true skills are in speechwriting, or creative dance, or making YouTube commentaries of videogames? None of those things are even on the syllabus.
在几十亿的社会中,很明显,不是所有人都能在学校的那几门课程中表现出色的。如果你真正的特长是写演讲稿、即兴舞蹈或者在网上写游戏测评?学校可不会考这些。
And so most people grow up without much passion for anything.
所以才会有那么多人在成长中是难以发现激情的。
Rule 3: Passion can be created
3.创造激情
It may help to know that the most successful people in life generally didn’t pick their passion off a shelf.
最成功的那些人可不是在书中发现自己的激情的。

 

In fact, many of the world’s most successful people dropped out of education entirely. Not because they were stupid – but because they found other areas where they were more skilled that education did not recognise.
实际上,世界上最成功的那些人,很多干脆辍学了。不是因为笨。他们发现了教育根本没顾忌到的领域。
They created their own passions.
他们自己创造了自己的激情。
Only a tiny fraction of people can expect to excel in the narrow subjects that childhood primes us for. And competition in that space is basically ‘everybody in the world who went to school’, which doesn’t help our chances.
关于我们童年教育所针对的那些事情,可能只有很少的一部分人能出类拔萃。基本上,你是在和全世界上学的孩子一起竞争。这就是说,如果你真的是万里挑一,那全世界还有几百万人和你一样万里挑一——泪奔么?
But if you look outside of that space, you’ll find less competition, and more options. And this is how you tip the odds of finding a passion in your favour.
但你得跳出圈子看这个问题,少一点竞争,多一点选择。你才可能发现激情。
Option 1: Create something方法一:创造新东西。
When you create something new, you’re inventing something to be passionate about.
当你创造出新东西时,这玩意会让你获得激情的。
You might design novelty cushions, or write Batman stories, or start a Twitter account dedicated to fact-checking politicians.
比如设计一个很新奇的坐垫,写一则蝙蝠侠往事,在微博上注册个专用于黑郭敬明的账号(作者说黑政治家,结合国情,我们还是聊郭敬明吧)。

 

New things are relatively uncontested. By creating something new, you’ve made your odds of becoming exceptional far, far higher.
新东西就没那么多人来跟你竞争。你需要和成千上万竞争者PK,才可能进入Google/百度;但若是自己创业,专搞挖掘机专业英语培训,基本上你不用和任何人竞争。
Now it’s important to note that this doesn’t sidestep Rule #1: passion comes from success. So if your new Twitter account only has 5 followers after a year, you probably won’t be too passionate about it. If you had 5 million, you’d have quit your job. You must find success to fuel your passion.
需要注意的是,这和【第一条:激情源于成功】不太一致。你注册的“郭敬明研究院院长“长期只有几个粉丝,恐怕要不了几个月你就没劲了;但如果你有五百万粉丝,估计你干脆就辞职在家专门写段子发软文了。激情的小火苗离不开不断的成功来作为燃料。

 

But at least you’ve drastically improved your odds, because your competition is so limited. Only a handful of people will even dare to try something new. And you can be one of them, just by starting.
不过话说回来,至少你另辟蹊径,获得激情的概率会提高。很少有人敢于尝试新鲜东西,只要去开这个头,你也能成为这少数人之一。
You see this pattern throughout history’s greats. A student called Mark was never going to be the world’s greatest programmer. But he started building cool websites, and he found he was unusually good at this because even better programmers rarely dared to try. It just so happens one of his little experiments became Facebook.
看一看历史上那些伟人,很多都是在这个模式下成其伟业的。有个叫马克的学生,本来是不可能成为世界上最好的程序员的;不过他决定去创建网站,他发现自己特别善于把网站做的很酷,比那些更出色的程序员更出色了。他的小实验叫Facebook.
Option 2: Lead a new trend方法二:引领新潮流
The older and more established an area is, the harder it will be to compete in. Millions have got there before you, and the lower your odds of standing out, the lower your odds of being passionate.
一个领域越是历史悠久,其中的竞争就越激烈。无数人已经比你先占好位置了,你很难脱颖而出,也就难以获得激情。
But there’s always a new frontier being born, a place where everyone else is hopelessly incapable, and even modest skills can be impressive.
但任何一个领域的产生,总有一个起点。在这个起点,任何人都和你一样,一无所知,一无所长。

 

Say you were a teenager who started making YouTube videos, back in 2005. You grow a modest following, and your growing success excites you. By the time the ‘grown up’ world had realised YouTube was Kind-Of-A-Big-Deal with 4 billion views every single day, you’ve become a passionate master of an invaluable new craft.
比如,你是个喜欢鼓捣视频的小伙子,在2005的情人节闲着无事,发现另一群单身汉这天创建了个网站叫Youtube. 既然这么有缘,你就注册了自己的账号,传几段有趣的视频,刚开始没人搭理你,渐渐有人来你的主页上溜达,到后来人越来越多,你的成就感与日俱增,你的激情也越来越大。而这个时候,Youtube已经火起来了,你作为最早的使用者之一,俨然已经成为网站大V了,谈笑风生。
That isn’t fantasy. There are mountains of hugely successful YouTubers, and most started in the same way: before everybody else. It’s the same for the first bloggers, rappers, and videogame designers.
这不是做梦,Youtube上有太多太多这样的成功者,他们仅仅是比别人更早使用罢了。同样的,最早写博客的人,制作网络歌曲的人,视频游戏设计者,都有类似的情况。
If you can find something new that’s growing fast, and get skilled at it early, you’ll find it disproportionately easy to excel because of the lack of competition. And that’s your new passion right there.
如果你发现了长势喜人的新事物,赶紧掌握它吧。你会发现没有了太多竞争,出色起来,真是好轻松啊。这就是新潮流给你带来的激情。
Option 3: Fuse mediocrity方法三:熔炼平凡
One limitation of education is it’s designed to narrow your skills. Education generally finds your One Best Thing, and pushes that thing as far as you can stand it:
教育的局限之一是,它会让你的技能越来越来专一;它会让你在某个领域的某个方向上越走越远,以至于让最初的你无法想象。

 

The problem is most of us, by definition, can’t be the best in any one area. But we can be exceptional in our combinations.
问题是,我们大多数人是不可能在一个领域里成为最好的那一个;却可以在我们自己创造的领域里做的最好。
Say you’re an average artist, with a decent sense of humour. You won’t have much hope with an art degree, and you can’t study ‘humour’ as a subject. But you could be an awesome cartoonist.
比如你是一个很一般的艺术家,不过幽默感还不错。你没法成为艺术大师,也不太可能成为一个谐星;不过你却会是一个出色的漫画家。
Or take an average business student, with some programming ability, and decent sales skills. That person is surprisingly well suited to become the boss of others who were better than them in any one of those areas.
或者你是一个普通的商科学生,会一点编程,还懂点推销技巧。那你就去做个领导者吧,让比你更懂商业的人、更懂编程、更懂推销的人,在你手下各自发挥所长。
The most successful people are almost never defined by a single skill. They are a fusion of skills, often not even exceptional skills, but they’ve made their fusion exceptional. Steve Jobs was not the world’s greatest engineer, salesperson, designer or businessman. But he was uniquely good enough at all of these things, and wove them together into something far greater.
成功者不是靠某一项技能的。他们通常是多种能力融合体,而且其中的任何一种能力可能也不会太出众,但这个融合体就非常出众了。乔布斯如果可以拆成几个部件的话,可以是工程师、销售、设计、商人,每一部件都不是最好的,不过都有其独特之处,而其组装一起后,就可以称得上伟大了。
This is the final route you have to finding your passion: combine skills into something more valuable. Remember, passion comes from success. If a new combination gets you better results, that could be your passion right there.
寻找激情的终极大法即是:把自己的技能融合成更有价值的东西。记住,激情源自成功,你的聚合物如果能让你有所成就,那它就是你要寻找的。
Why passion matters为什么要有激情?
Passion is attractive. As passion comes from believing you’re unusually good at something, being passionate is a very sincere way of saying, “by the way, I’m awesome”.
激情会让你更有魅力。对事情的激情在某种程度上就是一种自信,能向比人传递出你很在行、值得信赖的信息。

 

Passion will persuade people to follow you. It will persuade people to believe in you. But most importantly, passion will persuade yourself. Passion is an emotion specifically intended to make you go crazy and work your ass off at something because your brain believes it could rock your world. That, like love, is a feeling worth fighting for.
人们愿意追随有激情的人。因为我们通常会信任那些充满激情的人,不过最重要的是,激情会让你自己信任自己。激情会让你为之痴迷、癫狂,愿意拿出十二分努力,因为你坚信这会改变你的一切。就像你愿意为爱痴狂。
And like love, what we’re passionate about is too important to leave to the mercy of fate. If you haven’t found your passion yet, create new things, lead new trends, and fuse new combinations. But don’t ever stop looking.
就像爱,我们注以激情的东西,对自己来说太重要了,以至于不愿听天由命。如果你还没找到激情所在,试试创造新的东西,尝试新的方式,或者在已有的技能上,看看能不能提炼出不一样的东西。Just keep looking.

246月/150

缔元信:用户画像技术助推大数据落地

发布在 邵珠庆

dratio-dmp-data[原文:IT专家网] 企业要如何快速地从大数据的发展中获益?日前,北京缔元信互联网数据技术有限公司(以下简称“缔元信”)产品副总裁、曾长期担任新浪网数据分析部总监的牛程先生做客IT专家网《专家会客室》,分享了他心目中的企业释放大数据潜能的最佳实践。

牛程表示,对于大多数企业而言,自建大数据平台并非明智的选择,通过第三方专业的数据服务来实现大数据的价值,可以低成本、快速、准确地获得专属的商业洞见,能够有效地跨越数据分析人才匮乏的现状。目前的阶段,要借助大数据来影响市场营销资源的投放,基于传统的贴标签功能依托IT技术进行聚类分析而成的网络用户画像是一项出色的应用,能够帮助企业实现高效运营和精准营销。

dratio-bigdata-1

网络用户画像数据成网站运营、精准营销的基础

  企业上马大数据有两道坎

根据市场调研机构IDC的统计数据,2013年全球产生的数据大约为2.72ZB,但分析过的数据仅占其中的12%。如果我们再套用“二八定律”来分析,则能够从数据分析中受益的更是少之又少了。

要想获得新的应用,中国企业往往选择新建自己的平台,但在牛程看来,企业想要自主搭建大数据平台,从交易和互联产生的几何级增长的数据中获益,还存在两个难题:数据和人才。

从大数据的4V来说,我们需要大量、多样和快速的数据,才能真正地体现价值。牛程表示,企业除了内部CRM平台的数据,还需要用户离开这些平台以后的数据,需要各种终端产生的数据,但企业自建平台,往往只有CRM数据,即便有一些企业采集了SNS数据,也还是不够全面,不利于产生需要的结果。

IDC大数据与分析、数据管理及企业应用高级项目经理Daniel-Zoe Jimenez亦有类似观点:真正的机遇在于将客户数据等内部数据源与社交网络和站点等外部数据源加以整合。这有助于企业全面了解他们的客户业务和环境,让他们能够掌握客户的喜好、习惯和未来需求。

另一方面,数据-知识-决策的转换,需要有数据处理、数据挖掘和决策的人才的支撑。目前,尽管开源软件目前非常发达,硬件变得廉价,但若没有BAT那样的研发实力,搭建企业级大数据平台所需要的兼容性、稳定性和安全性都很困难,更不用说实时分析和决策了。一项调查显示,83% 的人认为数据分析对业务至关重要,但65% 的人表示他们无力自建数据分析系统、无力聘请数据分析师。

 

  用户画像数据成网站运营的基础

如前所述,缺乏相关技能集和最佳工具以及流程方面的差距对中国企业构成了挑战。我国在数据的开放性、流动性和交互性以及原有大量积累数据缺乏真实性是我们的挑战。但从缔元信看来,利用互联网服务平台和用户行为数据,可以很容易规避数据的问题,则剩下的就是技能和工具。

我们知道,互联网服务平台能够汇聚海量的生产信息、交易信息与消费者信息 ,使信息这一核心生产要素广泛应用于经济生产活动。因此,平台型互联网企业更能为大数据应用做出有效探索,有的企业已经在这个领域有所建树,如阿里、百度都有相关案例。

当然,阿里、百度、京东等更多的是为自身业务的发展来利用数据,尽管百度也开放了其大数据引擎,但对于一般企业来说,它们未必是普适的平台。针对企业大数据通用的解决方案,牛程提出了一个用户分群画像的概念,通过用户画像与分群的研究,为网站运营、营销策略、广告运营、推广提供数据支持。

网站用户分群画像核心价值在于精细化的定位人群特征,挖掘潜在的用户群体,为媒体网站、广告主、企业及广告公司充分认知群体用户的差异化特征,根据族群的差异化特征,帮助客户找到营销机会、运营方向,全面提高客户的核心影响力。

dratio-bigdata-2

基于用户画像技术的数据服务原理

  传统的对用户贴标签的功能,往往局限于静态的结果,用户画像则是动态、立体的解决方案,通过精细化人群定位,多维度交叉筛选查询,客户根据数据分析、挖掘潜在用户群。

  缔元信的实践分享

目前,缔元信已经将牛程分享的这套理论进行产品化,发布了“网站用户分群画像”和“缔元信DMP”两款产品,前者为媒体网站、广告主、企业及广告公司提供网站营销、网站运营的数据支持服务;后者针对DSP(精准投放)平台提供数据服务,通过可视化的操作界面方便客户对目标用户人群数据的选取并将该数据输出给DSP平台,为精准投放的实施提供数据,提高转化率。

两款产品依托缔元信先前开发的缔元信数据管理平台(DDMP),将第一方标签与第三方标签相结合,对每一个用户标签化,然后按不同的评估维度和模型算法,通过聚类方式将具有相同特征的用户划分成不同属性的族群,用特定的名称作为实际用户群的虚拟代表,并进行画像描绘,洞察其商业价值及用户价值。

用户画像技术的出现,能够帮助客户了解群体的差异化特征,根据族群的差异化特征设计并提供有针对性的产品及服务。缔元信用户分群画像系统以TGI指数(目标群体指数)和用户构成两大核心指标,分析消费者的购买行为、态度、生活形态和媒体接触习惯,以及目标用户群体在指定范围内占有的比例,多维度判别目标用户群在媒体的优、劣势及用户价值。

dratio-bigdata-3

  缔元信网络用户分群画像的用户构成界面

  通过TGI指数,可以为销售团队的客户定位、营销策略和方案的制定提供支撑;评估网站资源优劣态势,为内容运营、产品规划提供支撑;评估网站资源之间(频道、栏目、内容、产品等)的优势关联关系。

谈及缔元信产品的优势,牛程表示,主要来自于拥有全样本第三方标签,精细化的人群定位,具有7年的数据积累,并拥有为数据管理而生的专业的技术团队,能够为企业提供大数据时代数据化、高效精良的服务。

视频链接:《牛程:专业数据服务助推大数据落地

236月/150

数据论水浒:解析108名梁山好汉

发布在 邵珠庆

梁山一百单八将都是如何落草为寇的?他们都是什么”学历”?除了大碗喝酒大块吃肉,他们真的是替天行道吗?

落草的成了”好汉”,入仕的成了”奸佞”,这之间有一个什么样的衡量标准?

他们,为什么上梁山?

纵观梁山一百单八将,他们上山的原因,大致可以分为以下五种。

第一种:被自己人陷害–以卢俊义为代表。

这里的”自己人”是指一百单八将里的人,如杨志被晁盖、吴用等劫了生辰纲。虽然那时杨志还没走上革命道路,但是日后却在一起了,所以也算是被自己人陷害的。

这种人里,有卢俊义、秦明、李应、朱仝、杨志、徐宁、燕青、萧让、安道全、金大坚、杜兴、李云,共十二人,其中天罡有七人,地煞有五人。

需要说明的是燕青。燕青是跟随主人一起的,若主人不被陷害,他还会在卢俊义府上做他的高级白领。

第二种:被官府(或者与官府有勾结的人)陷害,被迫上山–以林冲为代表。

这些人里,有宋江、林冲、花荣、柴进、鲁智深、武松、戴宗、解珍、解宝、朱武、裴宣、欧鹏、陈达、杨春、宋清、施恩,共十六人,其中天罡九人,地煞七人。可以从一定层次上直接代表着官逼民反的人数。

说明一下,朱武、陈达、杨春是否有这么悲惨,不得而知,原著只交代了他们三人”累被官司逼迫,不得已上山落草”。那么我们就姑且认为他们是被官府逼的吧。宋清是宋江的弟弟,自然跟他哥一样。鲁智深倒不是因为杀了人而上山,他是因为救了林冲被官府通缉才落草的。

第三种:被俘上山,由于个人意志、信仰不坚定,甘愿为梁山效力–以关胜为代表。

这些人里,有关胜、呼延灼、董平、张清、索超、宣赞、郝思文、韩滔、彭玘、单廷珪、魏定国、凌振、扈三娘、龚旺、丁得孙、蔡福、蔡庆、郁保四,共十八人,其中天罡五人,地煞十三人。

有些人可能会对蔡福、蔡庆有异议。实际上在攻打大名府的时候,他俩已经被软禁了,和被俘又有何区别?值得注意的是,梁山军此时正在大名府烧杀抢掠,还是蔡福说了句”大官人可救一城百姓,休教残害”。等传下令时,”城中将及伤损一半”。从这话可以看出梁山军的一贯作风。可惜兄弟俩只有蔡庆活到了”解放后”(平了方腊)。

郁保四是作为人质和曾生一起上梁山谈判的,实际上也是俘虏的一种。

第四种:因杀人越货触犯了法律,为逃避法律制裁不得已而上山–以晁盖、吴用等人为代表。

晁盖、吴用、公孙胜等人在劫了生辰纲之后,是因为东窗事发,不得已才上山的。若不是白胜拿着分到的银子去赌博不小心露了馅儿,他们一时半会还是不会上山的。

这批人里,有吴用、公孙胜、刘唐、李逵、史进、穆弘、雷横、李俊、阮小二、张横、阮小五、张顺、阮小七、杨雄、石秀、黄信、孙立、燕顺、吕方、郭盛、王英、孔明、孔亮、童威、童猛、孟康、侯健、乐和、穆春、杜迁、薛永、朱富、李立、石勇、孙新、顾大嫂、白胜,共三十七人。其中,天罡十五人,地煞二十二人。

有一些革命同志,如李逵等,也不是主动要上山的。虽然说上山可以大碗喝酒大块吃肉大肆砍人,不过他那时还是一个小小的国家干部,还当着小牢子,虽然无赖,但还不至于把脑袋别在裤腰带上干造反工作。只有劫法场救了宋江、戴宗之后,他才真正犯下不赦之罪,只好上山了。

第五种:无明显上山理由。

比如向往梁山大碗喝酒痛快–这和当年很多青年参加红军的道理是一样的;还有一些人,原著中没有交代,一出场即是土匪。我以为,这一批人天生革命觉悟极高,为造反而生,以造反为乐。

这批人里,有邓飞、杨林、蒋敬、皇甫端、鲍旭、樊瑞、项充、李衮、马麟、郑天寿、陶宗旺、曹正、宋万、李忠、周通、汤隆、邹渊、邹润、朱贵、焦挺、张青、孙二娘、王定六、时迁、段景住,共二十五人。没有一个天罡,全是地煞。

梁山革命根据地的两个创始人杜迁、宋万为何不在一起?因为杜迁和王伦是受了”鸟气”来到梁山落草的,而宋万后来才到。所以杜迁是个人原因,而宋万没有交代,只好”革命觉悟高”了。

上述五种原因如果列成表的话,将会更直观:

一、各种革命类型的数量、百分比分布

数据论水浒

数据论水浒

二、各种革命类型,在天罡、地煞中的分布

水浒论水浒

根据上图,我们可以得出什么结论?

一、在总人数中,由于自身触犯法律,为了逃避大宋法律制裁而投奔梁山的人数最多。这些人,在天罡中占据主导地位,在地煞中也高据第二。

那么我们基本上可以认定,这些人,大部分都是无事生非、九处响锣十处有他的那种人。他们的活跃度很高,唯恐天下不乱,而个人能力又很强。这些人,占据了天罡数的42%。

这批人为何在天罡中有如此之多的票数?主要是劫生辰纲,产生了六个天罡,劫法场救宋江,又产生了五个天罡,所以,票数很多。

二、天罡星中,革命觉悟都很低,没有一个是主动上山的。在天罡星中,人群从高到低依次是:由于自身原因上山的、被官府陷害被迫上山的、被自己人陷害上山的,最后是被俘上山的。

由于革命意志不是很坚定,所以,梁山集团最后的被招安,也是不可避免的了。

三、地煞星的革命觉悟最高,很多人在梁山还没有发展壮大的情况下,已经有了自己的一片革命根据地。但也正是由于大伙的文化程度不高,光有热情没有能力是不够的,所以避免不了最后被梁山吞并的结局。同时大伙能力普遍不是很高,只好排到地煞星去了。低天罡星一等啊!

四、 被自己人陷害的一类中,天罡星的比例明显比地煞星要高。这是由于天罡星中的多是能厮杀的人,他们对正处于成长阶段的梁山集团来说是多多益善。

五、总体来看,真正”官逼民反”的,只占总数的15%。这在一定程度上证明了大家一直认为的”官逼民反”是成立的,但我们还应该看到,其中的绝大多数人,要么是无事生非之辈,要么是杀人越货之徒,再就是被俘的原大宋公务员,他们并非都是官逼民反。像王英之流,”原是车家出身。为因半路里见财起意,就势劫了客人。事发到官,越狱走了”,这是死活都和革命沾不上边的。

总结了这么多,实际上结论只有一条,在《水浒传》里,只有造反才是那些人最好的选择。如果不造反,大部分的革命同志只能死于非命,而造反是一项投入产出比小、风险大收益小的特殊工种,除了头几年有把脑袋别在裤腰带上的危险之外,之后还有两条路可以走:

A. 招安;

B. 自己打出一片天地,当了开国元勋。

施老爷子没把他们的造反写成功,估计也是知道哪怕就算是成功,最后也免不了来一个”杯酒释兵权”吧。这还算是文明的,要是学朱元璋同学最后大肆屠杀功臣,那就更完蛋了。

数据论水浒

附梁山一百单八将落草原因

1. 宋 江:利用职权,私放晁盖;与梁山勾结,被二奶阎婆惜发觉;不甘被敲诈,杀了二奶;事发后被捉拿归案,刺配江州;题反诗被黄文炳识破,判处死刑;后被梁山好汉救出,上山落草。

2. 卢俊义:因名头太大,被宋江看中欲赚之上山;遂被吴用诬造反,并怂恿其家人出首告发;获罪被判刺配沙门岛,李固和贾氏贿赂董超、薛霸欲在路上将其杀害,被燕青救出;奔赴梁山途中再次落入官兵之手,梁山好汉打破大名府将其救出,上山落草。

3. 吴 用:劫生辰纲事发,上山落草。

4. 公孙胜:劫生辰纲事发,上山落草。

5. 关 胜:被呼延灼设计引入埋伏圈,被俘,上山落草。

6. 林 冲:被高俅害得家破人亡,无家可归,经柴进介绍,上山落草。

7. 秦 明:被花荣用计生俘,灌醉后宋江派小卒假扮他攻打青州,害其一家老小被慕容知府杀害;最后无处可去,上山落草。

8. 呼延灼:攻打梁山泊被徐宁破了连环马,不得已去青州借兵,又被三山聚义好汉戏弄;后被宋江生俘,上山落草。

9. 花 荣:原为清风寨武知寨(副职),本与刘高文知寨(正职)有隙,为解救宋江,与刘高彻底决裂,又被黄信生俘;解送途中被清风山燕顺、王英、郑天寿救出;后生俘秦明,又通过秦明说服黄信,三人一同上山落草。

10. 柴 进:未上山之前,已与梁山有私交;后因殷天锡(高俅叔伯兄弟、高唐州知府高廉老婆的兄弟)强占其叔父柴皇城花园,与李逵一起前与高唐州看望;殷天锡作威作福,李逵怒从胆边生,杀了殷天锡并逃回梁山;柴进被控指使李逵打死殷天锡,被打入死囚牢,柴皇城家产被抄;李逵从梁山搬救兵救出柴进,柴进上山落草。

11. 李 应:三打祝家庄时被萧让、戴宗等假扮官人捉拿,押解途中被林冲等人”解救”上山;吴用派人将李家庄烧成白地,并取其家眷;后路被断,只得上山落草。

12. 朱 仝:未上山之前,与梁山已有往来;后因私放雷横,刺配沧州,每日陪小衙内玩耍,被吴用、雷横、李逵等用计杀了小衙内,不得已只好上山。

13. 鲁智深:因救林冲恶了高俅,被迫远走江湖;被张青、孙二娘麻翻,介绍投奔二龙山;原二龙山头领邓龙不接纳,与杨志、曹正设计占了二龙山宝珠寺,上山落草。

14. 武 松:因杀死潘金莲等被刺配孟州;替施恩做打手得罪了蒋门神,蒋门神买通张都监诬陷武松做贼,将其刺配恩州;路上张都监、蒋门神派人欲结果武松性命,反被武松大闹飞云浦,血溅鸳鸯楼;事发后,经孙二娘、张青介绍上二龙山落草。

15. 董 平:原为东平府兵马都监,因求婚一事与太守程万里不和;后被宋江用计生俘,为梁山所用;以其原有身份,赚开东平府城门,杀程太守抢其女,从此上山落草。

16. 张 清:原为东昌府猛将,打东昌府时被林冲赶下水,被三阮生俘,上山落草。

17. 杨 志:三代将门之后,因丢失花石纲逃往他处避难,后被赦;欲行贿高俅求官复原职,高俅(及下人)收了钱不办事;杨志穷困潦倒,草市卖刀不料误杀牛二,被刺配大名府;因与索超比武被梁中书赏识,做了管军提辖使;替梁中书押送生辰纲被劫,不得已与鲁智深一同用计夺了二龙山宝珠寺落草。

18. 徐 宁:本是随驾金枪班教师,懂得使钩镰枪;不幸被时迁盗了家传宝甲,后被其表弟汤隆等用计赚上山落草。

19. 索 超:宋江攻打大名府时被俘,上山落草。

20. 戴 宗:欲用假信救宋江,被黄文炳识破,同罪判处死刑;后被梁山好汉救出,上山落草。

21. 刘 唐:劫生辰纲事发,上山落草。

22. 李 逵:劫法场救宋江后,上山落草。

23. 史 进:本与少华山勾结,事发后杀死俩都头并李吉,不愿意落草而去投奔王进;寻王进不得结识鲁智深,因鲁智深拳打镇关西而离开渭州;后至延州、北京,盘缠用尽,与鲁智深一起火烧瓦罐寺后分手,投少华山落草。

24. 穆 弘:劫法场救宋江后,上山落草。

25. 雷 横:本与梁山勾结;因打了白玉乔,被知县姘头告了一状,戴枷示众;后因白秀英与其母亲厮打,用枷打死白秀英;被朱仝私放,上山落草。

26. 李 俊:劫法场救宋江后,上山落草。

27. 阮小二:劫生辰纲事发,上山落草。

28. 张 横:劫法场救宋江后,上山落草。

29. 阮小五:劫生辰纲事发,上山落草。

30. 张 顺:劫法场救宋江后,上山落草。

31. 阮小七:劫生辰纲事发,上山落草。

32. 杨 雄:杀了与和尚裴如海私通的老婆潘巧云,投奔梁山落草。

33. 石 秀:杀了与杨雄老婆潘巧云勾搭的头陀和报晓和尚,与杨雄一起杀了潘巧云,无处可去,投奔梁山落草。

34. 解 珍:因官府下令限期捉拿大虫,打死老虎后被毛太公诬陷入狱;毛太公勾结王正、包吉等欲结果其性命,得乐和等救出,杀了毛太公一家老小,投奔梁山落草。

35. 解 宝:同解珍。

36. 燕 青:被李固赶出家门,因救卢俊义杀了董超薛霸;投奔梁山途中,卢俊义被官兵劫走,遂上梁山搬救兵,救出卢俊义后一同上山落草。

37. 朱 武:”累被官司逼迫,不得已上山落草”。

38. 黄 信:为救宋江,打破清风寨,一同上山落草。

39. 孙 立:为劫狱救解氏兄弟,上山落草。

40. 宣 赞:被秦明生擒,上山落草。

41. 郝思文:被扈三娘生擒,上山落草。

42. 韩 滔:被刘唐、杜迁生擒,上山落草。

43. 彭 玘:被扈三娘生擒,上山落草。

44. 单廷珪:被关胜生擒,上山落草。

45. 魏定国:被围,向关胜投降,上山落草。

46. 萧 让:梁山欲救宋江,被戴宗赚上梁山落草。

47. 裴 宣:”为因朝廷除将一员贪滥知府到来,把他寻事,刺配沙门岛。”路过饮马川被救上山落草。

48. 欧 鹏: “因恶了本官,逃走在江湖上。”原著中未交代为何落草,出场即为黄门山头领。

49. 邓 飞:原著并未交代,开场即为饮马川头领。

50. 燕 顺:原是贩羊马客人出身,因为消折了本钱,占据清风山落草。

51. 杨 林:原本也是绿林中人,后遇公孙胜,被举荐上梁山。

52. 凌 振:攻打梁山时落水被生俘,上山落草。

53. 蒋 敬:原著未交代,只说:”原是落科举子出身。科举不弟,弃文就武。颇有谋略,精通书算,积万累千,纤毫不差。亦能刺枪使棒,布阵排兵。”

54. 吕 方:”因贩生药到山东,消折了本钱,不能够还乡”,占对影山落草,后上梁山。

55. 郭 盛:”因贩水银货卖,黄河里遭风翻了船,回乡不得”,占对影山落草,后上梁山。

56. 安道全:被张顺杀死姘头并题”杀人者安道全也”,被迫上山落草。

57. 皇甫端:被张清举荐,上山落草。

58. 王 英:”原是车家出身。为因半路里见财起意,就势劫了客人。事发到官,越狱走了”,上清风山落草。

59. 扈三娘:二打祝家时被林冲生擒上山,被宋太公认为义女,上山落草。

60. 鲍 旭:原著未交代,原为枯树山头领,被李逵说服上梁山落草。

61. 樊 瑞:原著未交代,原为芒砀山头领,后被项充、李衮说服,一同上梁山。

62. 孔 明:因与本村财主争执而杀其全家,逃上白虎山落草。

63. 孔 亮:同孔明。

64. 项 充:原著未交代,原为芒砀头领,后被俘虏,留在梁山。

65. 李 衮:同项充。

66. 金大坚:梁山欲救宋江,被戴宗赚上梁山落草。

67. 马 麟:原著未交代,只说”原是小番子闲汉出身,吹得双铁笛,使得好大滚刀,百十人近他不得”。

68. 童 威:劫法场救宋江后,上山落草。

69. 童 猛:劫法场救宋江后,上山落草。

70. 孟 康:”原因押送花石纲,要造大舡,嗔怪这提调官催并责罚他,把本官一时杀了,弃家逃走在江湖上。”

71. 候 健:提供捉拿黄文炳线索,为宋江出气,后一同上山落草。

72. 陈 达:”累被官司逼迫,不得已上山落草”。

73. 杨 春:也是”累被官司逼迫,不得已上山落草”。

74. 郑天寿:路过清风山时与王英斗五六十回合不分胜负,被燕顺请上山落草。

75. 陶宗旺:原著未交代,只说”庄家田户出身。惯使一把铁锹,有的是气力,亦能使枪轮刀”。

76. 宋 清:与宋太公一起被同取上山落草。

77. 乐 和:为劫狱救解氏兄弟,上山落草。

78. 龚 旺:梁山打东昌府时被林冲、花荣生俘,上山落草。

79. 丁得孙:梁山打东昌府时被燕青打中马蹄,被吕方、郭盛生擒,上山落草。

80. 穆 春:劫法场救宋江后,上山落草。

81. 曹 正:”为因本处一个财主,将五千贯钱教小人来此山东做客,不想折本,回乡不得”,后助鲁智深打破二龙山,一并上山落草。

82. 宋 万:原著未交代,开场即为梁山泊头领。

83. 杜 迁:”因鸟气合着杜迁来这里落草。”

84. 薛 永:劫法场救宋江后,上山落草。

85. 施 恩:”因武松杀了张都监一家人口,官司着落他家追捉凶身,以此连夜拿家逃走在江湖上。”后投二龙山入伙。

86. 李 忠:与鲁智深在渭州分手之后,经过桃花山,被周通劫道;杀退周通,被请上桃花山落草。

87. 周 通:原著未交代,出场即为桃花山原主人,后投梁山。

88. 汤 隆:流落江湖,遇李逵,跟随上山落草。

89. 杜 兴:”因一口气上打死了同伙的客人,吃官司监在蓟州府里。杨雄见他说起拳棒都省得,一力维持,救了他。”后在李应家落草,”每日拨万论千”,后随李应上山落草。

90. 邹 渊:开场即为登云山头领,与邓飞、杨林、石勇为旧识,后救解氏弟兄一起上梁山。

91. 邹 润:开场即为登云山头领。

92. 朱 贵:”因在江湖上做客,消折了本钱,就于梁山泊落草。”

93. 朱 富:与哥哥朱贵一起,为救李逵麻翻师傅李云,后劝说李云与他一起上山落草。

94. 蔡 福:宋江攻破大名府,因照顾卢俊义有功,被硬请上山落草。

95. 蔡 庆:宋江攻破大名府,因照顾卢俊义有功,被硬请上山落草。

96. 李 立:原开黑店,因闹江州救宋江而上山落草。

97. 李 云:因押解李逵,被朱富麻倒,无法交差,只好上山落草。

98. 焦 挺:”平生最无面目(不顾面子,不讲交情),到处投人不着”,被李逵劝上梁山落草。

99. 石 勇:”为因赌博上一拳打死了个人,逃走在柴大官人庄上。”送信给宋江,一同上山。

100. 孙 新:为劫狱救解氏兄弟,上山落草。

101. 顾大嫂:为劫狱救解氏兄弟,上山落草。

102. 张 青:原在孟州道上开黑店,后投奔二龙山落草。

103. 孙二娘:原在孟州道上开黑店,后投奔二龙山落草。

104. 王定六:随张顺在取安道全时一同上山落草。

105. 郁保四:原为曾头市人马,随曾生一同上梁山谈判,被说服落草。

106. 白 胜:劫生辰纲事发被捉拿,后被解救,上山落草。

107. 时 迁:”流落在此,则一地里做些飞檐走壁,跳篱骗马的勾当。曾在苏州府里吃官司,却得杨雄救了他。”听说石秀、杨雄欲上梁山,便一同跟去上山落草。

108. 段景住:以盗马为生,欲盗好马送给宋江作见面礼,因被劫了马而直接投奔梁山。

摘自《盗寇的潜规则:从数据看水浒》一书。

176月/150

房地产商如何玩转社区O2O

发布在 邵珠庆

2.jpg
房2.jpg5.jpg1.jpg
房5.jpg空间改造.jpg
房7.jpg

房8.jpg

*文章为作者独立观点,不代表虎嗅网立场
116月/150

MySQL Date and Time Functions

发布在 邵珠庆

Name Description
ADDDATE() Add dates
ADDTIME() Add time
CONVERT_TZ() Convert from one timezone to another
CURDATE() Return the current date
CURRENT_DATE(), CURRENT_DATE Synonyms for CURDATE()
CURRENT_TIME(), CURRENT_TIME Synonyms for CURTIME()
CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP Synonyms for NOW()
CURTIME() Return the current time
DATE_ADD() Add two dates
DATE_FORMAT() Format date as specified
DATE_SUB() Subtract two dates
DATE() Extract the date part of a date or datetime expression
DATEDIFF() Subtract two dates
DAY() Synonym for DAYOFMONTH()
DAYNAME() Return the name of the weekday
DAYOFMONTH() Return the day of the month (1-31)
DAYOFWEEK() Return the weekday index of the argument
DAYOFYEAR() Return the day of the year (1-366)
EXTRACT Extract part of a date
FROM_DAYS() Convert a day number to a date
FROM_UNIXTIME() Format date as a UNIX timestamp
HOUR() Extract the hour
LAST_DAY Return the last day of the month for the argument
LOCALTIME(), LOCALTIME Synonym for NOW()
LOCALTIMESTAMP, LOCALTIMESTAMP() Synonym for NOW()
MAKEDATE() Create a date from the year and day of year
MAKETIME MAKETIME()
MICROSECOND() Return the microseconds from argument
MINUTE() Return the minute from the argument
MONTH() Return the month from the date passed
MONTHNAME() Return the name of the month
NOW() Return the current date and time
PERIOD_ADD() Add a period to a year-month
PERIOD_DIFF() Return the number of months between periods
QUARTER() Return the quarter from a date argument
SEC_TO_TIME() Converts seconds to 'HH:MM:SS' format
SECOND() Return the second (0-59)
STR_TO_DATE() Convert a string to a date
SUBDATE() When invoked with three arguments a synonym for DATE_SUB()
SUBTIME() Subtract times
SYSDATE() Return the time at which the function executes
TIME_FORMAT() Format as time
TIME_TO_SEC() Return the argument converted to seconds
TIME() Extract the time portion of the expression passed
TIMEDIFF() Subtract time
TIMESTAMP() With a single argument, this function returns the date or datetime expression. With two arguments, the sum of the arguments
TIMESTAMPADD() Add an interval to a datetime expression
TIMESTAMPDIFF() Subtract an interval from a datetime expression
TO_DAYS() Return the date argument converted to days
UNIX_TIMESTAMP() Return a UNIX timestamp
UTC_DATE() Return the current UTC date
UTC_TIME() Return the current UTC time
UTC_TIMESTAMP() Return the current UTC date and time
WEEK() Return the week number
WEEKDAY() Return the weekday index
WEEKOFYEAR() Return the calendar week of the date (1-53)
YEAR() Return the year
YEARWEEK() Return the year and week
ADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days)

When invoked with the INTERVAL form of the second argument, ADDDATE() is a synonym for DATE_ADD(). The related function SUBDATE() is a synonym for DATE_SUB(). For information on the INTERVAL unit argument, see the discussion for DATE_ADD().

mysql> SELECT DATE_ADD('1998-01-02', INTERVAL 31 DAY);
+---------------------------------------------------------+
| DATE_ADD('1998-01-02', INTERVAL 31 DAY) |
+---------------------------------------------------------+
| 1998-02-02 |
+---------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT ADDDATE('1998-01-02', INTERVAL 31 DAY);
+---------------------------------------------------------+
| ADDDATE('1998-01-02', INTERVAL 31 DAY) |
+---------------------------------------------------------+
| 1998-02-02 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
When invoked with the days form of the second argument, MySQL treats it as an integer number of days to be added to expr.

mysql> SELECT ADDDATE('1998-01-02', 31);
+---------------------------------------------------------+
| DATE_ADD('1998-01-02', INTERVAL 31 DAY) |
+---------------------------------------------------------+
| 1998-02-02 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
ADDTIME(expr1,expr2)

ADDTIME() adds expr2 to expr1 and returns the result. expr1 is a time or datetime expression, and expr2 is a time expression.

mysql> SELECT ADDTIME('1997-12-31 23:59:59.999999','1 1:1:1.000002');
+---------------------------------------------------------+
| DATE_ADD('1997-12-31 23:59:59.999999','1 1:1:1.000002') |
+---------------------------------------------------------+
| 1998-01-02 01:01:01.000001 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
CONVERT_TZ(dt,from_tz,to_tz)

This converts a datetime value dt from the time zone given by from_tz to the time zone given by to_tz and returns the resulting value. This function returns NULL if the arguments are invalid.

mysql> SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET');
+---------------------------------------------------------+
| CONVERT_TZ('2004-01-01 12:00:00','GMT','MET') |
+---------------------------------------------------------+
| 2004-01-01 13:00:00 |
+---------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT CONVERT_TZ('2004-01-01 12:00:00','+00:00','+10:00');
+---------------------------------------------------------+
| CONVERT_TZ('2004-01-01 12:00:00','+00:00','+10:00') |
+---------------------------------------------------------+
| 2004-01-01 22:00:00 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
CURDATE()

Returns the current date as a value in 'YYYY-MM-DD' or YYYYMMDD format, depending on whether the function is used in a string or numeric context.

mysql> SELECT CURDATE();
+---------------------------------------------------------+
| CURDATE() |
+---------------------------------------------------------+
| 1997-12-15 |
+---------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT CURDATE() + 0;
+---------------------------------------------------------+
| CURDATE() + 0 |
+---------------------------------------------------------+
| 19971215 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
CURRENT_DATE and CURRENT_DATE()

CURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE()

CURTIME()

Returns the current time as a value in 'HH:MM:SS' or HHMMSS format, depending on whether the function is used in a string or numeric context. The value is expressed in the current time zone.

mysql> SELECT CURTIME();
+---------------------------------------------------------+
| CURTIME() |
+---------------------------------------------------------+
| 23:50:26 |
+---------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT CURTIME() + 0;
+---------------------------------------------------------+
| CURTIME() + 0 |
+---------------------------------------------------------+
| 235026 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
CURRENT_TIME and CURRENT_TIME()

CURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME().

CURRENT_TIMESTAMP and CURRENT_TIMESTAMP()

CURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().

DATE(expr)

Extracts the date part of the date or datetime expression expr.

mysql> SELECT DATE('2003-12-31 01:02:03');
+---------------------------------------------------------+
| DATE('2003-12-31 01:02:03') |
+---------------------------------------------------------+
| 2003-12-31 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
DATEDIFF(expr1,expr2)

DATEDIFF() returns expr1 . expr2 expressed as a value in days from one date to the other. expr1 and expr2 are date or date-and-time expressions. Only the date parts of the values are used in the calculation.

mysql> SELECT DATEDIFF('1997-12-31 23:59:59','1997-12-30');
+---------------------------------------------------------+
| DATEDIFF('1997-12-31 23:59:59','1997-12-30') |
+---------------------------------------------------------+
| 1 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
DATE_ADD(date,INTERVAL expr unit), DATE_SUB(date,INTERVAL expr unit)

These functions perform date arithmetic. date is a DATETIME or DATE value specifying the starting date. expr is an expression specifying the interval value to be added or subtracted from the starting date. expr is a string; it may start with a .-. for negative intervals. unit is a keyword indicating the units in which the expression should be interpreted.

The INTERVAL keyword and the unit specifier are not case sensitive.

The following table shows the expected form of the expr argument for each unit value;

unit Value ExpectedexprFormat
MICROSECOND MICROSECONDS
SECOND SECONDS
MINUTE MINUTES
HOUR HOURS
DAY DAYS
WEEK WEEKS
MONTH MONTHS
QUARTER QUARTERS
YEAR YEARS
SECOND_MICROSECOND 'SECONDS.MICROSECONDS'
MINUTE_MICROSECOND 'MINUTES.MICROSECONDS'
MINUTE_SECOND 'MINUTES:SECONDS'
HOUR_MICROSECOND 'HOURS.MICROSECONDS'
HOUR_SECOND 'HOURS:MINUTES:SECONDS'
HOUR_MINUTE 'HOURS:MINUTES'
DAY_MICROSECOND 'DAYS.MICROSECONDS'
DAY_SECOND 'DAYS HOURS:MINUTES:SECONDS'
DAY_MINUTE 'DAYS HOURS:MINUTES'
DAY_HOUR 'DAYS HOURS'
YEAR_MONTH 'YEARS-MONTHS'
The values QUARTER and WEEK are available beginning with MySQL 5.0.0.

mysql> SELECT DATE_ADD('1997-12-31 23:59:59',
-> INTERVAL '1:1' MINUTE_SECOND);
+---------------------------------------------------------+
| DATE_ADD('1997-12-31 23:59:59', INTERVAL... |
+---------------------------------------------------------+
| 1998-01-01 00:01:00 |
+---------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT DATE_ADD('1999-01-01', INTERVAL 1 HOUR);
+---------------------------------------------------------+
| DATE_ADD('1999-01-01', INTERVAL 1 HOUR) |
+---------------------------------------------------------+
| 1999-01-01 01:00:00 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
DATE_FORMAT(date,format)

Formats the date value according to the format string.

The following specifiers may be used in the format string. The .%. character is required before format specifier characters.

Specifier Description
%a Abbreviated weekday name (Sun..Sat)
%b Abbreviated month name (Jan..Dec)
%c Month, numeric (0..12)
%D Day of the month with English suffix (0th, 1st, 2nd, 3rd, .)
%d Day of the month, numeric (00..31)
%e Day of the month, numeric (0..31)
%f Microseconds (000000..999999)
%H Hour (00..23)
%h Hour (01..12)
%I Hour (01..12)
%i Minutes, numeric (00..59)
%j Day of year (001..366)
%k Hour (0..23)
%l Hour (1..12)
%M Month name (January..December)
%m Month, numeric (00..12)
%p AM or PM
%r Time, 12-hour (hh:mm:ss followed by AM or PM)
%S Seconds (00..59)
%s Seconds (00..59)
%T Time, 24-hour (hh:mm:ss)
%U Week (00..53), where Sunday is the first day of the week
%u Week (00..53), where Monday is the first day of the week
%V Week (01..53), where Sunday is the first day of the week; used with %X
%v Week (01..53), where Monday is the first day of the week; used with %x
%W Weekday name (Sunday..Saturday)
%w Day of the week (0=Sunday..6=Saturday)
%X Year for the week where Sunday is the first day of the week, numeric, four digits; used with %V
%x Year for the week, where Monday is the first day of the week, numeric, four digits; used with %v
%Y Year, numeric, four digits
%y Year, numeric (two digits)
%% A literal .%. character
%x x, for any.x. not listed above
mysql> SELECT DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');
+---------------------------------------------------------+
| DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y') |
+---------------------------------------------------------+
| Saturday October 1997 |
+---------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT DATE_FORMAT('1997-10-04 22:23:00'
-> '%H %k %I %r %T %S %w');
+---------------------------------------------------------+
| DATE_FORMAT('1997-10-04 22:23:00....... |
+---------------------------------------------------------+
| 22 22 10 10:23:00 PM 22:23:00 00 6 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
DATE_SUB(date,INTERVAL expr unit)

This is similar to DATE_ADD() function.

DAY(date)

DAY() is a synonym for DAYOFMONTH().

DAYNAME(date)

Returns the name of the weekday for date.

mysql> SELECT DAYNAME('1998-02-05');
+---------------------------------------------------------+
| DAYNAME('1998-02-05') |
+---------------------------------------------------------+
| Thursday |
+---------------------------------------------------------+
1 row in set (0.00 sec)
DAYOFMONTH(date)

Returns the day of the month for date, in the range 0 to 31.

mysql> SELECT DAYOFMONTH('1998-02-03');
+---------------------------------------------------------+
| DAYOFMONTH('1998-02-03') |
+---------------------------------------------------------+
| 3 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
DAYOFWEEK(date)

Returns the weekday index for date (1 = Sunday, 2 = Monday, ., 7 = Saturday). These index values correspond to the ODBC standard.

mysql> SELECT DAYOFWEEK('1998-02-03');
+---------------------------------------------------------+
|DAYOFWEEK('1998-02-03') |
+---------------------------------------------------------+
| 3 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
DAYOFYEAR(date)

Returns the day of the year for date, in the range 1 to 366.

mysql> SELECT DAYOFYEAR('1998-02-03');
+---------------------------------------------------------+
| DAYOFYEAR('1998-02-03') |
+---------------------------------------------------------+
| 34 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
EXTRACT(unit FROM date)

The EXTRACT() function uses the same kinds of unit specifiers as DATE_ADD() or DATE_SUB(), but extracts parts from the date rather than performing date arithmetic.

mysql> SELECT EXTRACT(YEAR FROM '1999-07-02');
+---------------------------------------------------------+
| EXTRACT(YEAR FROM '1999-07-02') |
+---------------------------------------------------------+
| 1999 |
+---------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT EXTRACT(YEAR_MONTH FROM '1999-07-02 01:02:03');
+---------------------------------------------------------+
| EXTRACT(YEAR_MONTH FROM '1999-07-02 01:02:03') |
+---------------------------------------------------------+
| 199907 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
FROM_DAYS(N)

Given a day number N, returns a DATE value.

mysql> SELECT FROM_DAYS(729669);
+---------------------------------------------------------+
| FROM_DAYS(729669) |
+---------------------------------------------------------+
| 1997-10-07 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
Use FROM_DAYS() with caution on old dates. It is not intended for use with values that precede the advent of the Gregorian calendar (1582).

FROM_UNIXTIME(unix_timestamp)

FROM_UNIXTIME(unix_timestamp,format)

Returns a representation of the unix_timestamp argument as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context. The value is expressed in the current time zone. unix_timestamp is an internal timestamp value such as is produced by the UNIX_TIMESTAMP() function.

If format is given, the result is formatted according to the format string, which is used the same way as listed in the entry for the DATE_FORMAT() function.

mysql> SELECT FROM_UNIXTIME(875996580);
+---------------------------------------------------------+
| FROM_UNIXTIME(875996580) |
+---------------------------------------------------------+
| 1997-10-04 22:23:00 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
HOUR(time)

Returns the hour for time. The range of the return value is 0 to 23 for time-of-day values. However, the range of TIME values actually is much larger, so HOUR can return values greater than 23.

mysql> SELECT HOUR('10:05:03');
+---------------------------------------------------------+
| HOUR('10:05:03') |
+---------------------------------------------------------+
| 10 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
LAST_DAY(date)

Takes a date or datetime value and returns the corresponding value for the last day of the month. Returns NULL if the argument is invalid.

mysql> SELECT LAST_DAY('2003-02-05');
+---------------------------------------------------------+
| LAST_DAY('2003-02-05') |
+---------------------------------------------------------+
| 2003-02-28 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
LOCALTIME and LOCALTIME()

LOCALTIME and LOCALTIME() are synonyms for NOW().

LOCALTIMESTAMP and LOCALTIMESTAMP()

LOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for NOW().

MAKEDATE(year,dayofyear)

Returns a date, given year and day-of-year values. dayofyear must be greater than 0 or the result is NULL.

mysql> SELECT MAKEDATE(2001,31), MAKEDATE(2001,32);
+---------------------------------------------------------+
| MAKEDATE(2001,31), MAKEDATE(2001,32) |
+---------------------------------------------------------+
| '2001-01-31', '2001-02-01' |
+---------------------------------------------------------+
1 row in set (0.00 sec)
MAKETIME(hour,minute,second)

Returns a time value calculated from the hour, minute, and second arguments.

mysql> SELECT MAKETIME(12,15,30);
+---------------------------------------------------------+
| MAKETIME(12,15,30) |
+---------------------------------------------------------+
| '12:15:30' |
+---------------------------------------------------------+
1 row in set (0.00 sec)
MICROSECOND(expr)

Returns the microseconds from the time or datetime expression expr as a number in the range from 0 to 999999.

mysql> SELECT MICROSECOND('12:00:00.123456');
+---------------------------------------------------------+
| MICROSECOND('12:00:00.123456') |
+---------------------------------------------------------+
| 123456 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
MINUTE(time)

Returns the minute for time, in the range 0 to 59.

mysql> SELECT MINUTE('98-02-03 10:05:03');
+---------------------------------------------------------+
| MINUTE('98-02-03 10:05:03') |
+---------------------------------------------------------+
| 5 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
MONTH(date)

Returns the month for date, in the range 0 to 12.

mysql> SELECT MONTH('1998-02-03')
+---------------------------------------------------------+
| MONTH('1998-02-03') |
+---------------------------------------------------------+
| 2 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
MONTHNAME(date)

Returns the full name of the month for date.

mysql> SELECT MONTHNAME('1998-02-05');
+---------------------------------------------------------+
| MONTHNAME('1998-02-05') |
+---------------------------------------------------------+
| February |
+---------------------------------------------------------+
1 row in set (0.00 sec)
NOW()

Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context. The value is expressed in the current time zone.

mysql> SELECT NOW();
+---------------------------------------------------------+
| NOW() |
+---------------------------------------------------------+
| 1997-12-15 23:50:26 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
PERIOD_ADD(P,N)

Adds N months to period P (in the format YYMM or YYYYMM). Returns a value in the format YYYYMM. Note that the period argument P is not a date value.

mysql> SELECT PERIOD_ADD(9801,2);
+---------------------------------------------------------+
| PERIOD_ADD(9801,2) |
+---------------------------------------------------------+
| 199803 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
PERIOD_DIFF(P1,P2)

Returns the number of months between periods P1 and P2. P1 and P2 should be in the format YYMM or YYYYMM. Note that the period arguments P1 and P2 are not date values.

mysql> SELECT PERIOD_DIFF(9802,199703);
+---------------------------------------------------------+
| PERIOD_DIFF(9802,199703) |
+---------------------------------------------------------+
| 11 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
QUARTER(date)

Returns the quarter of the year for date, in the range 1 to 4.

mysql> SELECT QUARTER('98-04-01');
+---------------------------------------------------------+
| QUARTER('98-04-01') |
+---------------------------------------------------------+
| 2 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
SECOND(time)

Returns the second for time, in the range 0 to 59.

mysql> SELECT SECOND('10:05:03');
+---------------------------------------------------------+
| SECOND('10:05:03') |
+---------------------------------------------------------+
| 3 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
SEC_TO_TIME(seconds)

Returns the seconds argument, converted to hours, minutes, and seconds, as a value in 'HH:MM:SS' or HHMMSS format, depending on whether the function is used in a string or numeric context.

mysql> SELECT SEC_TO_TIME(2378);
+---------------------------------------------------------+
| SEC_TO_TIME(2378) |
+---------------------------------------------------------+
| 00:39:38 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
STR_TO_DATE(str,format)

This is the inverse of the DATE_FORMAT() function. It takes a string str and a format string format. STR_TO_DATE() returns a DATETIME value if the format string contains both date and time parts, or a DATE or TIME value if the string contains only date or time parts.

mysql> SELECT STR_TO_DATE('04/31/2004', '%m/%d/%Y');
+---------------------------------------------------------+
| STR_TO_DATE('04/31/2004', '%m/%d/%Y') |
+---------------------------------------------------------+
| 2004-04-31 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
SUBDATE(date,INTERVAL expr unit) and SUBDATE(expr,days)

When invoked with the INTERVAL form of the second argument, SUBDATE() is a synonym for DATE_SUB(). For information on the INTERVAL unit argument, see the discussion for DATE_ADD().

mysql> SELECT DATE_SUB('1998-01-02', INTERVAL 31 DAY);
+---------------------------------------------------------+
| DATE_SUB('1998-01-02', INTERVAL 31 DAY) |
+---------------------------------------------------------+
| 1997-12-02 |
+---------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT SUBDATE('1998-01-02', INTERVAL 31 DAY);
+---------------------------------------------------------+
| SUBDATE('1998-01-02', INTERVAL 31 DAY) |
+---------------------------------------------------------+
| 1997-12-02 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
SUBTIME(expr1,expr2)

SUBTIME() returns expr1 . expr2 expressed as a value in the same format as expr1. expr1 is a time or datetime expression, and expr2 is a time.

mysql> SELECT SUBTIME('1997-12-31 23:59:59.999999',
-> '1 1:1:1.000002');
+---------------------------------------------------------+
| SUBTIME('1997-12-31 23:59:59.999999'... |
+---------------------------------------------------------+
| 1997-12-30 22:58:58.999997 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
SYSDATE()

Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context.

mysql> SELECT SYSDATE();
+---------------------------------------------------------+
| SYSDATE() |
+---------------------------------------------------------+
| 2006-04-12 13:47:44 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
TIME(expr)

Extracts the time part of the time or datetime expression expr and returns it as a string.

mysql> SELECT TIME('2003-12-31 01:02:03');
+---------------------------------------------------------+
| TIME('2003-12-31 01:02:03') |
+---------------------------------------------------------+
| 01:02:03 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
TIMEDIFF(expr1,expr2)

TIMEDIFF() returns expr1 . expr2 expressed as a time value. expr1 and expr2 are time or date-and-time expressions, but both must be of the same type.

mysql> SELECT TIMEDIFF('1997-12-31 23:59:59.000001',
-> '1997-12-30 01:01:01.000002');
+---------------------------------------------------------+
| TIMEDIFF('1997-12-31 23:59:59.000001'..... |
+---------------------------------------------------------+
| 46:58:57.999999 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
TIMESTAMP(expr), TIMESTAMP(expr1,expr2)

With a single argument, this function returns the date or datetime expression expr as a datetime value. With two arguments, it adds the time expression expr2 to the date or datetime expression expr1 and returns the result as a datetime value.

mysql> SELECT TIMESTAMP('2003-12-31');
+---------------------------------------------------------+
| TIMESTAMP('2003-12-31') |
+---------------------------------------------------------+
| 2003-12-31 00:00:00 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
TIMESTAMPADD(unit,interval,datetime_expr)

Adds the integer expression interval to the date or datetime expression datetime_expr. The unit for interval is given by the unit argument, which should be one of the following values: FRAC_SECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.

The unit value may be specified using one of keywords as shown, or with a prefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY both are legal.

mysql> SELECT TIMESTAMPADD(MINUTE,1,'2003-01-02');
+---------------------------------------------------------+
| TIMESTAMPADD(MINUTE,1,'2003-01-02') |
+---------------------------------------------------------+
| 2003-01-02 00:01:00 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
TIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2)

Returns the integer difference between the date or datetime expressions datetime_expr1 and datetime_expr2. The unit for the result is given by the unit argument. The legal values for unit are the same as those listed in the description of the TIMESTAMPADD() function.

mysql> SELECT TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01');
+---------------------------------------------------------+
| TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01') |
+---------------------------------------------------------+
| 3 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
TIME_FORMAT(time,format)

This is used like the DATE_FORMAT() function, but the format string may contain format specifiers only for hours, minutes, and seconds.

If the time value contains an hour part that is greater than 23, the %H and %k hour format specifiers produce a value larger than the usual range of 0..23. The other hour format specifiers produce the hour value modulo 12.

mysql> SELECT TIME_FORMAT('100:00:00', '%H %k %h %I %l');
+---------------------------------------------------------+
| TIME_FORMAT('100:00:00', '%H %k %h %I %l') |
+---------------------------------------------------------+
| 100 100 04 04 4 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
TIME_TO_SEC(time)

Returns the time argument, converted to seconds.

mysql> SELECT TIME_TO_SEC('22:23:00');
+---------------------------------------------------------+
| TIME_TO_SEC('22:23:00') |
+---------------------------------------------------------+
| 80580 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
TO_DAYS(date)

Given a date date, returns a day number (the number of days since year 0).

mysql> SELECT TO_DAYS(950501);
+---------------------------------------------------------+
| TO_DAYS(950501) |
+---------------------------------------------------------+
| 728779 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
UNIX_TIMESTAMP(), UNIX_TIMESTAMP(date)

If called with no argument, returns a Unix timestamp (seconds since '1970-01-01 00:00:00' UTC) as an unsigned integer. If UNIX_TIMESTAMP() is called with a date argument, it returns the value of the argument as seconds since '1970-01-01 00:00:00' UTC. date may be a DATE string, a DATETIME string, a TIMESTAMP, or a number in the format YYMMDD or YYYYMMDD.

mysql> SELECT UNIX_TIMESTAMP();
+---------------------------------------------------------+
| UNIX_TIMESTAMP() |
+---------------------------------------------------------+
| 882226357 |
+---------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT UNIX_TIMESTAMP('1997-10-04 22:23:00');
+---------------------------------------------------------+
| UNIX_TIMESTAMP('1997-10-04 22:23:00') |
+---------------------------------------------------------+
| 875996580 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
UTC_DATE, UTC_DATE()

Returns the current UTC date as a value in 'YYYY-MM-DD' or YYYYMMDD format, depending on whether the function is used in a string or numeric context.

mysql> SELECT UTC_DATE(), UTC_DATE() + 0;
+---------------------------------------------------------+
| UTC_DATE(), UTC_DATE() + 0 |
+---------------------------------------------------------+
| 2003-08-14, 20030814 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
UTC_TIME, UTC_TIME()

Returns the current UTC time as a value in 'HH:MM:SS' or HHMMSS format, depending on whether the function is used in a string or numeric context.

mysql> SELECT UTC_TIME(), UTC_TIME() + 0;
+---------------------------------------------------------+
| UTC_TIME(), UTC_TIME() + 0 |
+---------------------------------------------------------+
| 18:07:53, 180753 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
UTC_TIMESTAMP, UTC_TIMESTAMP()

Returns the current UTC date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context.

mysql> SELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;
+---------------------------------------------------------+
| UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0 |
+---------------------------------------------------------+
| 2003-08-14 18:08:04, 20030814180804 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
WEEK(date[,mode])

This function returns the week number for date. The two-argument form of WEEK() allows you to specify whether the week starts on Sunday or Monday and whether the return value should be in the range from 0 to 53 or from 1 to 53. If the mode argument is omitted, the value of the default_week_format system variable is used

Mode First Day of week Range Week 1 is the first week .
0 Sunday 0-53 with a Sunday in this year
1 Monday 0-53 with more than 3 days this year
2 Sunday 1-53 with a Sunday in this year
3 Monday 1-53 with more than 3 days this year
4 Sunday 0-53 with more than 3 days this year
5 Monday 0-53 with a Monday in this year
6 Sunday 1-53 with more than 3 days this year
7 Monday 1-53 with a Monday in this year
mysql> SELECT WEEK('1998-02-20');
+---------------------------------------------------------+
| WEEK('1998-02-20') |
+---------------------------------------------------------+
| 7 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
WEEKDAY(date)

Returns the weekday index for date (0 = Monday, 1 = Tuesday, . 6 = Sunday).

mysql> SELECT WEEKDAY('1998-02-03 22:23:00');
+---------------------------------------------------------+
| WEEKDAY('1998-02-03 22:23:00') |
+---------------------------------------------------------+
| 1 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
WEEKOFYEAR(date)

Returns the calendar week of the date as a number in the range from 1 to 53. WEEKOFYEAR() is a compatibility function that is equivalent to WEEK(date,3).

mysql> SELECT WEEKOFYEAR('1998-02-20');
+---------------------------------------------------------+
| WEEKOFYEAR('1998-02-20') |
+---------------------------------------------------------+
| 8 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
YEAR(date)

Returns the year for date, in the range 1000 to 9999, or 0 for the .zero. date.

mysql> SELECT YEAR('98-02-03');
+---------------------------------------------------------+
| YEAR('98-02-03') |
+---------------------------------------------------------+
| 1998 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
YEARWEEK(date), YEARWEEK(date,mode)

Returns year and week for a date. The mode argument works exactly like the mode argument to WEEK(). The year in the result may be different from the year in the date argument for the first and the last week of the year.

mysql> SELECT YEARWEEK('1987-01-01');
+---------------------------------------------------------+
| YEAR('98-02-03')YEARWEEK('1987-01-01') |
+---------------------------------------------------------+
| 198653 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
Note that the week number is different from what the WEEK() function would return (0) for optional arguments 0 or 1, as WEEK() then returns the week in the context of the given year.