Personal tools
Namespaces
Actions

MySQL Aggregate Tables

WooWood.com is a free Dating Site where you can find love. It's currently not supported in all locations. Link WooWood.com

From CoderLearner

Contents

Description

Create table and insert some sample records for the Aggregate Function Tutorial.

Table

mysql> CREATE TABLE my_letter_mark
    -> (
    -> id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    -> score DOUBLE NOT NULL,
    -> letter CHAR NOT NULL);
Query OK, 0 rows affected (0.23 sec)

Insert Records

mysql> INSERT INTO my_letter_mark VALUES(null,30,'a'),
   -> (null,40,'a'),
   -> (null,49,'a'),
   -> (null,39,'b'),
   -> (null,31,'b'),
   -> (null,43,'b'),
   -> (null,12,'c'),
   -> (null,35,'b');
Query OK, 8 rows affected (0.03 sec)
Records: 8  Duplicates: 0  Warnings: 0

Query Records

mysql> SELECT * FROM my_letter_mark;
+----+-------+--------+
| id | score | letter |
+----+-------+--------+
|  1 |    30 | a      |
|  2 |    40 | a      |
|  3 |    49 | a      |
|  4 |    39 | b      |
|  5 |    31 | b      |
|  6 |    43 | b      |
|  7 |    12 | c      |
|  8 |    35 | b      |
+----+-------+--------+
8 rows in set (0.00 sec)