站内搜索: 请输入搜索关键词
当前页面: 图书首页 > MySQL Tutorial

MySQL Tutorial

[ Directory ] Previous Section Next Section

Answers

Quiz

A1:

c

A2:

a

A3:

c

A4:

d

A5:

b


Exercises

A1:

create database orders;

use orders;

create table customer
(
  customerID int not null auto_increment primary key,
  customerName varchar(20),
  customerAddress varchar(80)
) type = InnoDB;

create table orders
(
  orderID int not null auto_increment primary key,
  orderDate date,
  customerID int not null references customer(customerID)
) type = InnoDB;

create table item
(
  itemID int not null auto_increment primary key,
  itemName varchar(20)
) type = InnoDB;

create table orderItem
(
  orderID int not null references orders(orderID),
  itemID int not null references item(itemID),
  itemQuantity int,
  primary key (orderID, itemID)
) type = InnoDB;

A2:

alter table orders
add column comment text;

A3:

drop database orders;

Note that we have changed the name of the table called order to orders because order is a reserved word. You may also choose to put quotes around it to get it to work.


    [ Directory ] Previous Section Next Section