Sponsored Content
Top Forums Web Development Notes with Ravinder on Badging System Development Part II Post 303028191 by Neo on Tuesday 1st of January 2019 01:04:01 PM
Old 01-01-2019
Hey Ravinder.

If I were you, I would do this query:

Code:
mysql> select joindate from user where userid =1;

Take that result subtracted from today in UNIXTIME and divide by the number of seconds in year.

That gives you the number of years a person has been a member.

You don't need that fancy MySQL query with all the date / time functions for such a trivial requirement.

As you are beginner in programming, keep it simple... well, I suggest you keep it simple all your life; it's easier to debug or change when you look at the code in 10 years..... keep it simple. Do not be seduced by fancy queries and logic which look cool.... like many programmers and tech people do.

Keep it simple so that a 10th grader can understand it.
 

3 More Discussions You Might Find Interesting

1. What is on Your Mind?

New Badging System - Badges Prototype Beta 1 (Badges Only)

Today I mapped out the new badging system using FA icons, Beta 1 in no particular order except a 6 x 8 grid: https://www.unix.com/members/1-albums215-picture991.png The prototype HTML code for this layout: <style> .fa-badge-grid { font-size: 1.5em; } .row { ... (38 Replies)
Discussion started by: Neo
38 Replies

2. What is on Your Mind?

Status of Badging System - Beta 1

Dear All, Here is the current status of the badging system: The Beta 1 phase of the new badging system is close to completion. 42 prototype badges have been "allocated" 6 prototype badge slots are held in reserve The "alert you have new badges" prototype is running and is currently... (4 Replies)
Discussion started by: Neo
4 Replies

3. What is on Your Mind?

Badging System: UNIX.COM Bug Hunter Badge (New)

I have moved the bug badge out of reserve and into the main stream. Basically, I will assign a color level like the others, based on who has made a good actionable bug report for UNIX.COM. "Good" means screenshots, links, and even details from web dev tools our the HTML source code. So far,... (0 Replies)
Discussion started by: Neo
0 Replies
MYSQLDUMPSLOW(1)					       MySQL Database System						  MYSQLDUMPSLOW(1)

NAME
mysqldumpslow - Summarize slow query log files SYNOPSIS
mysqldumpslow [options] [log_file ...] DESCRIPTION
The MySQL slow query log contains information about queries that take a long time to execute (see Section 5.2.5, "The Slow Query Log"). mysqldumpslow parses MySQL slow query log files and prints a summary of their contents. Normally, mysqldumpslow groups queries that are similar except for the particular values of number and string data values. It "abstracts" these values to N and 'S' when displaying summary output. The -a and -n options can be used to modify value abstracting behavior. Invoke mysqldumpslow like this: shell> mysqldumpslow [options] [log_file ...] mysqldumpslow supports the following options. o --help Display a help message and exit. o -a Do not abstract all numbers to N and strings to 'S'. o --debug, -d Run in debug mode. o -g pattern Consider only queries that match the (grep-style) pattern. o -h host_name Host name of MySQL server for *-slow.log file name. The value can contain a wildcare. The default is * (match all). o -i name Name of server instance (if using mysql.server startup script). o -l Do not subtract lock time from total time. o -n N Abstract numbers with at least N digits within names. o -r Reverse the sort order. o -s sort_type How to sort the output. The value of sort_type should be chosen from the following list: o t, at: Sort by query time or average query time o l, al: Sort by lock time or average lock time o s, as: Sort by rows sent or average rows sent o c: Sort by count o -t N Display only the first N queries in the output. o --verbose, -v Verbose mode. Print more information about what the program does. Example of usage: shell> mysqldumpslow Reading mysql slow query log from /usr/local/mysql/data/mysqld51-apple-slow.log Count: 1 Time=4.32s (4s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost insert into t2 select * from t1 Count: 3 Time=2.53s (7s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost insert into t2 select * from t1 limit N Count: 3 Time=2.13s (6s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost insert into t1 select * from t1 COPYRIGHT
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc. This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. SEE ALSO
For more information, please refer to the MySQL Reference Manual, which may already be installed locally and which is also available online at http://dev.mysql.com/doc/. AUTHOR
Sun Microsystems, Inc. (http://www.mysql.com/). MySQL 5.1 04/06/2010 MYSQLDUMPSLOW(1)
All times are GMT -4. The time now is 09:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy