Archive: MySQL Tips
-
Aug 16, 2011
No CommentsHow to Use SQL JOIN to Retrieve Data from Multiple Tables : php2php.com
Summary: In this tutorial, you will learn how to use SQL JOIN to select data from multiple database tables. You will learn different kinds of JOIN including inner join, outer join, left and right joins. In the previous tutorial, you’ve learned how to retrieve data from one table by using SELECT statement. But normally you...
-
Aug 16, 2011
No Commentshow to Avoid Displaying NULL Values by Mapping to Other Values : php2php.com
The NULL was introduced by the creator of relational database model, Dr.E.F.Codd. In relational database management systems, NULL means unknown value or the value does not exist in database. MySQL supports NULL to represents the concept of missing information and inapplicable information. Sometimes, we have to display the stored data which has NULL value to...
-
Aug 16, 2011
No CommentsCompare Two Tables to Find Unmatched Records : PHP2PHP.com
In database programming, sometimes you have to compare two tables (or two views of more than two tables) to find the unmatched records and the difference between two records in two tables with the same identity. As an example, in database migration you have a legacy database and new database with two different database schemata....
-
Aug 16, 2011
No CommentsSelect the Nth Highest Record in a Database Table : PHP2php.com
Summary: In this tutorial, you will learn how to select the Nth highest record in a database table by using various techniques. These techniques are very useful, for instance you may want to see the product which is second most expensive in Products database table. The first idea is we get the Nth highest result...
-
Aug 16, 2011
No CommentsCount Records in a Database Table in MySQL : php2php.com
Summary: In this tutorial, you will learn how to use an aggregate function called MySQL COUNT to count number of records in a database table. In order to count a number of records in a database table we can use standard SQL COUNT function. The syntax is quite simple as follows: 1 SELECT COUNT(*) AS...
-
Aug 16, 2011
No CommentsUsing Regular Expression in MySQL : How to Use Regular Expression in MySQL : PHP2PHP.com
Summary: In this tutorial, you will learn how to use regular expression with SQL SELECT statement to retrieve data based on complicated patterns. Regular expression is a powerful tool which gives you a concise and flexible way to identify strings of text, for instance characters, words or patterns of characters. As an example, you can...
-
Aug 16, 2011
No CommentsSelect Random Records in Database Table at php2php.com
Summary: In this tutorial, you will learn various techniques to select random records from a database table in MySQL. MySQL does not have any automatic way to select random items from a database table. In some programming tasks, it is required and very useful to select random items from a result set such as: You’ll need...
-
Aug 16, 2011
No CommentsMySQL Copy Database Table tutorial on php2php.com
Summary: In this tutorial, you will learn how to copy data from one table into a new table by using SQL CREATE TABLE and SELECT statement. Copying data from an existing table to a new one is useful in some cases such as backing up data, create a copying of real data for testing. In order...
-
Jul 26, 2011
No CommentsWhat is MySQL’s Database hostname?
This documentation details your database hostname. Database Hostname: 127.0.0.1 (also known as “localhost“) Usage: When setting up a WordPress, ZenCart, OsCommerce, Magento, Drupal or Joomla style of website, you will need to specify where your database is located. Note: For advanced users, if connecting to our server from your local machine, simply use your domain...