Microsoft Word - Sam's Teach Yourself MySQL in 21 Days - SAMS.doc

(singke) #1

  1. How would you get the total number of transactions that occurred on March 1, 2000?

  2. SELECT COUNT(Transaction_ID)

  3. FROM Transactions
    WHERE Transaction_Date = '20000301";


Day 11



  1. Imagine that you have a table called Orders, and you want to update it while no
    other threads can read from it. You also have a table called Products, which you
    want to read from but not update. Write the syntax for appropriate locking and
    unlocking of these tables.

  2. LOCK TABLES orders WRITE, products READ;

  3. ...
    UNLOCK TABLES;

  4. Consider each of the following scenarios. In which would you consider applying a key
    to the table? Would you use a unique or non-unique key?

  5. A table containing the birthdays of all of the people you know. Your
    computer accesses it once a day to see if it's anyone's birthday today,
    and, if so, emails him or her a greeting.
    ƒ A non-unique key

  6. A table of products available to order from your online shop. Duplicates
    are not allowed.
    ƒ A unique key

  7. A table that records the sales tax applied to products sold. It is written to
    each time a product is sold, but read from only once per quarter.
    ƒ No key


Day 12



  1. List the advantages and disadvantages to using an interface as opposed to the
    MySQL Monitor program.
    ƒ Advantages:
    ƒ Interfaces allow you to perform complex database operations
    programmatically.
    ƒ They allow you to control what is entered into your database and
    perform error checking.
    ƒ Disadvantages:
    ƒ You have to know a programming language to create the interface.
    ƒ The development cycle is long.

  2. What are the basic requirements for a database connection?


Server name or IP address, username and password, database name.

Day 12



  1. List the advantages and disadvantages to using an interface as opposed to the
    MySQL Monitor program.
    ƒ Advantages:
    ƒ Interfaces allow you to perform complex database operations
    programmatically.
    ƒ They allow you to control what is entered into your database and
    perform error checking.
    ƒ Disadvantages:
    ƒ You have to know a programming language to create the interface.
    ƒ The development cycle is long.

  2. What are the basic requirements for a database connection?


Server name or IP address, username and password, database name.

Day 14



  1. Create a Perl script that takes a request from the user and displays values from the
    database based on the given value. For example, with the Meet_A_Geek
    database, create a Web page that allows a person to see a list of customers based

Free download pdf