Get the number, name, and date of birth of each player resident in Stratford; sort the result in alphabetical : Simple Select « Select Clause « SQL / MySQL






Get the number, name, and date of birth of each player resident in Stratford; sort the result in alphabetical

      
order of name
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> SELECT PLAYERNO, NAME, BIRTH_DATE
    -> FROM PLAYERS
    -> WHERE TOWN = 'Stratford'
    -> ORDER BY NAME;
+----------+-----------+------------+
| PLAYERNO | NAME      | BIRTH_DATE |
+----------+-----------+------------+
|        6 | Parmenter | 1964-06-25 |
|        7 | Wise      | 1963-05-11 |
+----------+-----------+------------+
2 rows in set (0.00 sec)

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

mysql>

   
    
    
    
    
    
  








Related examples in the same category

1.Explain select command
2.Do math calculation with select
3.SELECT statement includes three select list elements
4.Select rows
5.The expression in the select list subtracts the Reserved value from the total
6.Removing duplicates and selecting only the unique combinations of values in the specified columns
7.Display the names of only those authors whose surname starts with one of the letters L through Z:
8.Determines all employees whose names contain the sequence of letters er.
9.Use a wildcard (*) to return all the fields
10.Using mysql as a Calculator
11.Identifying What Values to Display
12.Using the aliases p1 and p2 to refer to the book table different ways