Databases| SQL| MySQL| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Mysql Difference 
 

Mysql Difference is used to return the records that are the outcome of difference between the records in a table.

 

Mysql Difference

                         

Mysql Difference is used to return the records that are the outcome of difference between the records in a table.

Understand with Example

The Tutorial illustrate an example from 'Mysql Difference'.To understand this example we create a table 'Multiplication'.The table 'Multiplication' is created with required field name and datatype respectively.

 

 

 

 

 

Query for creating table name Multiplication:

mysql>  CREATE TABLE Multiplication(
    ->              a int(10),
    ->              b int(19),
    ->              c int(21)
    ->             );
Query OK, 0 rows affected (0.03 sec)

Query for Multiple insertion of data in table:

The Query insert into for inserting a multiple records or rows to the table 'Multiplication'.

mysql> insert into Multiplication (a,b,c)values
    ->                     (12,13,15),
    ->                     (22,23,25),
    ->                     (32,33,35),
    ->                     (42,43,45),
    ->                     (52,53,55),
    ->                     (62,65,64
Query OK, 6 rows affected (0.00 sec)
Records: 6  Duplicates: 0  Warnings: 0

Query to view data inserted in table:

To view the records we use select query that returns you table details.

mysql> select * from multiplication;

Output:-

mysql> select * from multiplication;
+------+------+------+
| a    | b    | c    |
+------+------+------+
| 12   | 13   | 15   |
| 22   | 23   | 25   |
| 32   | 33   | 35   |
| 42   | 43   | 45   |
| 52   | 53   | 55   |
| 62   | 65   | 64   |
+------+------+------+
6 rows in set (0.00 sec)

Query to view Mysql difference of data inserted in table:

The below Query in Mysql is used to view difference of data inserted in  a table 'Multiplication'.

mysql> select *,a-b  from multiplication ;

Output:-

+------+------+------+------+
| a    | b    | c    | a-b  |
+------+------+------+------+
| 12   | 13   | 15   | -1   |
| 22   | 23   | 25   | -1   |
| 32   | 33   | 35   | -1   |
| 42   | 43   | 45   | -1   |
| 52   | 53   | 55   | -1   |
| 62   | 65   | 64   | -3   |
+------+------+------+------+
6 rows in set (0.00 sec)

                         

» View all related tutorials
Related Tags: sql mysql c string com sed char compare operator using opera character like cte to ld e il li use

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.