Appendix E. Bonus Exercises

The exercises in this appendix are bonus walk-through exercises. We provide an explanation or question, and then provide the SQL code that you need to type at the mysql> prompt. Please study the question, code, and results carefully to improve your knowledge of SQL.

  1. Invoke MySQL and create a new database for bonus exercises.

    CREATE DATABASE BONUS;
    
  2. Point MySQL to your new database.

    USE BONUS;
    
  3. Create a table to keep track of basketball teams.

    CREATE TABLE TEAMS
    ( TEAM_ID        INTEGER(2)    NOT NULL,
      NAME           VARCHAR(20)   NOT NULL );
    
  4. Create a table to keep track of basketball players.

     CREATE TABLE PLAYERS ( PLAYER_ID INTEGER(2) NOT NULL, LAST VARCHAR(20) NOT NULL, FIRST VARCHAR(20) NOT NULL, TEAM_ID INTEGER(2) NULL, NUMBER INTEGER(2) ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.