Wednesday, 4 January 2012

MySql count


MySQL aggregate functions retrieve a single value after performing a calculation on a set of values.
In general, aggregate functions ignore null values.
Often, aggregate functions are accompanied by the GROUP BY clause of the SELECT statement.


MySQL COUNT() function us used to count of number of non-NULL values of a given expression.

This function return 0 when  does not find any matching row from the table.

Syntax

COUNT(expr);
Where expr is an expression.
SELECT COUNT(*)
FROM author;

Explanation

The above MySQL statement will return the number of rows in author table.

Output

mysql aggregate functions and grouping count function

See also : 
 Mysql count() function




MySQL find_in_set function

In MySQL the FIND_IN_SET() returns the position of a string when it present  within a list of strings.

The string list itself is a string contains substrings separated by ‘,’ (comma) character.

The return value 0 when search string does not exist in the string list.

The return value is  NULL if either of the arguments is NULL.

Syntax :

FIND_IN_SET (search string, string list)


Example

SELECT FIND_IN_SET('ank','b,ank,of,monk'); 

Explanation 

 

The above statement finds the search string ‘ank’ at 2nd place within the string list. So it returns 2.

Output

 

MYSQL FIND_IN_SET 

 

 

 

 

See also :

Mysql find_in_set function


Thursday, 15 September 2011

Getting started with MySQL


MySQL is a open source Relational Database Management System developed by Michael Widenius and David Axmark in 1994.
2. MySQL is very popular when it comes to Web development. It is widely-used as the database component of LAMP web application software stack.
3. Source code of MySQL is available under GNU General Public License.
4. MySQL is maintained by a Swedish company MySQL AB, now owned by Oracle Corporation.

Who uses MySQL

1. Some of the most visited websites like Flickr, Facebook, Wikipedia, Google (not for search), Nokia.com, YouTube.
2. Some most widely used Content Management Systems like WordPress, phpBB, Drupal.
3. Last but not least, a large number of web developers across the world.

What programming languages can be used with MySQL

You can use C, C++, PHP, ASP, Cold Fusion, Java etc.

On which platforms do MySQL work

AIX, BSDi, FreeBSD, HP-UX, i5/OS, Linux, Mac OS X, NetBSD, Novell NetWare, OpenBSD, OpenSolaris, eComStation, OS/2 Warp, QNX, IRIX, Solaris, Symbian, SunOS, SCO OpenServer, SCO UnixWare, Sanos, Tru64 and Microsoft Windows.

Some of the widely used MySQL front ends (tools for managing MySQL)

ToolsDescription
MySQL WorkbenchOfficial, GUI Based
MySQL GUI ToolsOfficial, GUI Based
phpMyAdminThird party, Free, Web based
HeidiSQLThird party, Free, For Windows
AdminerThird party, Free
DBEditThird party, Free
dbForge GUI ToolsThird party, Free
NavicatThird party, Commercial
MaatkitThird party, Command line, free
MySQL SandboxThird party, Command line, free

Key features of MySQL

1. MySQL follows ANSI SQL 99, the standard SQL.
2. Cross Platform.
3. RDBMS features like Stored procedures, Triggers, Cursors, Views which can be updated, True Varchar support, Query caching, Sub-SELECT etc.
4.Support for replication.
5. Support for hotbackup.
6. Support for MySQL cluster.
7. Full-text indexing and searching.
8. SSL support.
9. Partial Unicode support.

For a complete guide with hundreds of PHP MySQL Code, visit MySQL Tutorial of w3resource.