MySQL-driven Web Site Construction (Cont.)

  1. Database Implementation (Cont.)
  2. Note that MySQL text monitor is not working yet. Instead use MySQL Workbench to enter the SQL commands, which could be found from here.

    An Example of MySQL Database Processing
     undcemcs02> mysql -h undcsmysql.mysql.database.azure.com 
                     -u userid -p 
      Enter password: ******* 
    
      Welcome to the MySQL monitor.  Commands end with ; or \g.
      Your MySQL connection id is 2140
      Server version: 5.1.73 Source distribution
      Copyright (c) 2000, 2012, Oracle and/or its affiliates.
      All rights reserved. Oracle is a registered trademark of
      Oracle Corporation and/or its affiliates. Other names may
      be trademarks of their respective owners.
    
      Type 'help;' or '\h' for help. Type '\c' to clear the current
      input statement.
    
     mysql> show databases; 
     +--------------------+
     | Database           |
     +--------------------+
     | information_schema |
     | wenchen            |
     +--------------------+
     2 rows in set (0.00 sec)
    
     mysql> -- Comment: wenchen is the instructor’s database 
     mysql> use wenchen; 
     Database changed
    
     mysql> create table books ( 
         ->   title   char(128), 
         ->   ISBN    char(20) primary key, 
         ->   price   real ); 
     Query OK, 0 rows affected (0.07 sec)
    
     mysql> insert into books values ( 
         ->   'PHP for the World Wide Web', '0321245652', 14.29 ); 
     Query OK, 1 row affected (0.01 sec)
    
     mysql> insert into books values ( 
         ->   'Programming PHP', '1565926102', 26.39 ); 
     Query OK, 1 row affected (0.00 sec)
    
     mysql> select * from books; 
     +----------------------------+------------+-------+
     | title                      | ISBN       | price |
     +----------------------------+------------+-------+
     | PHP for the World Wide Web | 0321245652 | 14.29 |
     | Programming PHP            | 1565926102 | 26.39 |
     +----------------------------+------------+-------+
     2 rows in set (0.00 sec)
    
     mysql> commit; 
     Query OK, 0 rows affected (0.00 sec)
    
     mysql> exit; 
     Bye
    
     shell>

    Note that this database implementation is only an example and is not related to this exercise.
    The italic, white text on navy background is entered by users.
    The wenchen is the instructor’s database. The MySQL DBA should assign a different database to you.