Take advantage of today's free, fixed a bit of this function, tested, in the local server through, the Space Business Server can also be used normally, no errors found. My Kaspersky doesn't report poison. ^_^
As long as you modify, this function is
function to take advantage of today's free, fixed a bit of this function, tested, in the local server through, the space quotient server can also be used normally, no errors found. My Kaspersky doesn't report poison. ^_^
as long as the change,
1. Date Time function
Time Conversion second function: Time_to_sec
Mysql> Select Time_to_sec (' 01:01:01 ');+-------------------------+| Time_to_sec (' 01:01:01 ') |+-------------------------+| 3661 |+-------------------------+1 row in Set (0.00
One, call Sub procedureUnlike a Function procedure, in an expression, a Sub procedure cannot be invoked with its name, and a separate statement is invoked for a sub procedure. A Sub procedure differs from a function in that it does not return a
Create a table1. Create student and score tablesCREATE TABLE Student (ID INT (Ten) is not NULL UNIQUE PRIMARY KEY,Name VARCHAR () is not NULL,Sex VARCHAR (4),Birth year,Department VARCHAR (20),Address VARCHAR (50));Create a score table. the SQL code
MYSQL Query Day, this week, the last 7 days, this month, the last 30 days of statementsOriginal April 13, 2017 16:40:38
Label:
962
Edit
Delete
-The daySELECT * from table name wherewhere= to_days (now
TodaySelect * from where = To_days (now ());YesterdaySELECT * from WHERE - 1Nearly 7 daysSELECT * from where 7 Day Date (Time field name)Nearly 30 daysSELECT * from where - Day Date (Time field name)MonthSELECT * from WHERE ' %y%m ' = '
Mysql:TodaySELECT * FROM table name where To_days (Time field name) = To_days (now ());Yesterday1Nearly 7 days7 Day) Nearly 30 days MonthSELECT * FROM table name WHERE date_format (Time field name, '%y%m ') = Date_format (Curdate (), '%y%m ')Last
TodaySelect * from where = To_days (now ());YesterdaySELECT * from WHERE - 1Nearly 7 daysSELECT * from where 7 Day Date (Time field name)Nearly 30 daysSELECT * from where - Day Date (Time field name)MonthSELECT * from WHERE ' %y%m ' = '
Description1) can be used in the select/update/delete, and where , the2) in the function, the field name as an argument, the value of the variable is the value of each row corresponding to the field.3) in programming languages such as the
Time function:Now: Current Time band formatMysql> Select Now (); +---------------------+| Now () |+---------------------+| 2015-09-06 10:47:33 |+---------------------+1 row in Set (0.00 sec)To_days: Given a date , returns a number of
MySQL query all the information of the day:
The code is as follows
SELECT * FROM Test where year (regdate) =year (now ()) and month (RegDate) =month (today ()) and Day (regdate) =day (now)
This is a bit cumbersome, but also a simple wording:
The
Get the current date method one:
Copy Code code as follows:
Currentdate1=date ()
MsgBox Currentdate1
Get the current date method two:
Copy Code code as follows:
Currentdate2=year (now) & "-" &month (now) &
Knowledge Point: Learn to use time class and time class conversion between time format.
Requirements: 1. Execute business logic at a time of day in a thread
2. Update the time in the database table "take the time in the database and then update to
Copy Code code as follows:
Public function Fillzero (L1)
If Len (L1) =1 Then
fillzero= "0" &l1
Else
Fillzero=l1
End If
End Function
Usage examples:
Copy Code code as follows:
Response year (now) &month
09 is the most rapid development of E-commerce year, is also the site SEO optimization technology is the most popular one year, now in the Webmaster website, the forum self-proclaimed SEO master, experts everywhere are. So if everyone has mastered
Today on the Internet to find a few classic SQL exercises do a bit, although it is not difficult, but the foundation is very good, on the basis of understanding can be further analysis, to study the merits of various solutions, or even simple
Description1) can be used in the select/update/delete , and where, the 2) in the function, the field name as an argument, the value of the variable is the value of each row corresponding to the field.3) in programming languages such as the
1. Query the sname, Ssex, and class columns of all records in the student table.Select Sname,ssex,class from student;2, the inquiry teacher all units namely does not duplicate depart column.Select distinct depart from teacher3. Query all records of
TodaySELECT * FROM table name where To_days (Time field name) = To_days (now ());YesterdaySELECT * FROM table name WHERE to_days (now ())-To_days (Time field name) Nearly 7 daysSELECT * FROM table name where Date_sub (Curdate (), INTERVAL 7 day)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.