/*
    mysql is a relational database server that executes statements in the 
    SQL (Structure Query Language) standard language.

    Execute the commands below inside mysql
    or pipe the text file to the program
*/   

/*
    Tables are created and dropped (destroyed) using 
    DDL (Data Definition Language) statements.

    DDL example
*/

drop table if exists PRODUCT;

create table PRODUCT (
   CODE varchar(20) not null,
   PRICE double unsigned not null,
   DESCRIPTION varchar(100),
   primary key (CODE)
) type=InnoDB;


/*
    SQL examples
*/

INSERT INTO PRODUCT VALUES ("X1", 8.90, "DVD"),
                           ("Y2", 5.99, "CD"),
                           ("Z3", 10.5 , "Book");
                           

/*
    More SQL examples
    CRUD: Create (insert), Read (select), Update, and Delete data.
*/

INSERT INTO PRODUCT (CODE, PRICE, DESCRIPTION) VALUES('A1', 10.2, 'Soccer ball');

SELECT * FROM PRODUCT;

UPDATE PRODUCT SET PRICE=13 WHERE CODE='A1';
            
DELETE FROM PRODUCT WHERE DESCRIPTION LIKE '%ball%';
