Get the number of each player who joined the club after 1980 and is resident in Stratford; order the result by : Join Order « Join « SQL / MySQL






Get the number of each player who joined the club after 1980 and is resident in Stratford; order the result by

    
 player number.
mysql>
mysql>
mysql> CREATE TABLE PLAYERS
    -> (
    ->     PLAYERNO INTEGER NOT NULL,
    ->     NAME CHAR(15) NOT NULL,
    ->     INITIALS CHAR(3) NOT NULL,
    ->     BIRTH_DATE DATE ,
    ->     SEX CHAR(1) NOT NULL,
    ->     JOINED SMALLINT NOT NULL,
    ->     STREET VARCHAR(30) NOT NULL,
    ->     HOUSENO CHAR(4) ,
    ->     POSTCODE CHAR(6) ,
    ->     TOWN VARCHAR(30) NOT NULL,
    ->     PHONENO CHAR(13) ,
    ->     LEAGUENO CHAR(4) ,
    ->     PRIMARY KEY (PLAYERNO)
    -> );
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql>
mysql> INSERT INTO PLAYERS VALUES(6, 'Parmenter', 'R', '1964-06-25', 'M', 1977,'Haseltine Lane', '80', '1234KK', 'Stratf
ord','070-476537', '8467');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO PLAYERS VALUES(7, 'Wise', 'GWS', '1963-05-11', 'M', 1981,'Edgecombe Way', '39', '9758VB', 'Stratford'
,'070-347689', NULL);
Query OK, 1 row affected (0.00 sec)

mysql>
mysql>
mysql>
mysql> SELECT PLAYERNO
    -> FROM PLAYERS
    -> WHERE JOINED > 1980
    -> AND TOWN = 'Stratford'
    -> ORDER BY PLAYERNO;
+----------+
| PLAYERNO |
+----------+
|        7 |
+----------+
1 row in set (0.00 sec)

mysql>
mysql> drop table players;
Query OK, 0 rows affected (0.00 sec)

mysql>

   
    
    
    
  








Related examples in the same category

1.JOIN two tables with conditions and order
2.Join than order