Software Outsourcing, Offshore Software Development, Offshore Outsourcing Services, IT Outsourcing, Offshore Development
MySQL manual Offshore Software Outsourcing and Programming, IT Outsourcing Offshore Software Development  
Call Us Today: 1-800-678-9001
Offshore Software Outsourcing and Programming, IT Outsourcing Offshore Software Development

Home / Technical Support / MySQL

Key Offerings:

B2B and B2C E-Business Solutions

Offshore Software Development Outsourcing

Strategic Consulting

Offshore Software Outsourcing

About ALTOROS: ALTOROS Systems is headquartered in Tampa, Florida and maintains an office near Boston, Massachusetts and technology development center in Belarus and Russia. ALTOROS specializes on providing value-added e-commerce and web-based software development and offshore software outsourcing services to emerging enterprises helping them successfully plan and implement business initiatives.

Contact Us for more information.

Node: Examples, Next: Batch mode, Prev: Getting information, Up: Tutorial
Examples of Common Queries
 
Here are examples of how to solve some common problems with MySQL.
 
Some of the examples use the table shop to hold the price of each article (item number) for certain traders (dealers).  Supposing that each trader has a single fixed price per article, then (article, dealer) is a primary key for the records.
 
Start the command-line tool mysql and select a database:
 
mysql your-database-name
 
(In most MySQL installations, you can use the database-name 'test').
 
You can create the example table as:
 
CREATE TABLE shop (
article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,
dealer  CHAR(20)                 DEFAULT ''     NOT NULL,
price   DOUBLE(16,2)             DEFAULT '0.00' NOT NULL,
PRIMARY KEY(article, dealer));

INSERT INTO shop VALUES
(1,'A',3.45),(1,'B',3.99),(2,'A',10.99),(3,'B',1.45),(3,'C',1.69),
(3,'D',1.25),(4,'D',19.95);
 
Okay, so the example data is:
 
mysql> SELECT * FROM shop;

+---------+--------+-------+
| article | dealer | price |
+---------+--------+-------+
|    0001 | A      |  3.45 |
|    0001 | B      |  3.99 |
|    0002 | A      | 10.99 |
|    0003 | B      |  1.45 |
|    0003 | C      |  1.69 |
|    0003 | D      |  1.25 |
|    0004 | D      | 19.95 |
+---------+--------+-------+
 
 
example-Maximum-column      The maximum value for a column
example-Maximum-row      The row holding the maximum of a certain column
example-Maximum-column-group      Maximum of column per group
example-Maximum-column-group-row      The rows holding the group-wise maximum of a certain field
example-user-variables      Using user variables
example-Foreign keys      Using foreign keys
Searching on two keys      Searching on Two Keys
Calculating days      Calculating Visits Per Day
example-AUTO_INCREMENT      Using AUTO_INCREMENT
 
Offshore Software Outsourcing company Russia Florida Massachusetts Boston Belarus, Offshore Software Development Services, Offshore Programming and IT OutsourcingOffshore Development, Programming  Services, Tampa FL Russia, E-commerce, Database, CRM, Financial Insurance Health Care Real EstateOffshore Software Development Services, Software Outsourcing Russia
HOME PAGE, Offshore Software Outsourcing Company, offshore IT outsourcing services, offshore 
software development Russia Massachusetts Florida New York CT VT RI software development