
/* Chapter 5 - Try It Out sections */


/* Try It Out: Altering and Dropping Tables */

CREATE TABLE InStock
(
   ProductID SMALLINT
);


ALTER TABLE InStock
ADD COLUMN Quantity SMALLINT UNSIGNED NOT NULL,
MODIFY ProductID SMALLINT UNSIGNED NOT NULL,
ADD PRIMARY KEY (ProductID);


ALTER TABLE InStock
DROP COLUMN Quantity,
DROP PRIMARY KEY;



/* Try It Out: Creating a Table with an Index */

CREATE TABLE CDs
(
   CDID SMALLINT UNSIGNED NOT NULL,
   CDName VARCHAR(40) NOT NULL,
   INDEX (CDName)
);



/* Try It Out: Creating an Index with the ALTER TABLE Statement */

CREATE TABLE CDs
(
   CDID SMALLINT UNSIGNED NOT NULL PRIMARY KEY,
   CDName VARCHAR(40) NOT NULL
);



/* Try It Out: Creating an Index with the CREATE INDEX Statement */

CREATE TABLE CDs
(
   CDID SMALLINT UNSIGNED NOT NULL PRIMARY KEY,
   CDName VARCHAR(40) NOT NULL
);



