文档介绍:MySQL 开发者
SQL权威指南
SQL For MySQL Developers
prehensive Tutorial and Reference
整理:侯杰
第一章 SQL概要
,他的密码是BOOKSQLPW。
CREATE USER ‘BOOKSQL’@’LOCALHOST’ IDENTIFIED BY ‘BOOKSQLPW’
create user ‘houjie410782’@’localhost’ identified by ‘630529’
。
grant all privileges on *.* to ‘BOOKSQL’@’LOCALHOST’ with grant option;
grat all privileges on *.* to ‘houjie410782’@’localhost’ with grant option;
。
create database tennis;
。
use tennis;
,teams,matches,mittee_members。
create table players
(playerno integer not null,
name char(15) not null,
initials char(3) not null,
birth_date date,
sex char(1) not null,
joined smallint not null,
street varchar(30) not null,
houseno char(4),
postcode char(6),
town varchar(30) not null,
phoneno char(13),
leagueno char(4),
primary key (playerno)
)
create table teams(
teamno integer not null,
playerno integer not null,
division char(6) not null,
primary key (teamno)
)
create table matches(
matchno integer not null,
teamno integer not null,
playerno integer not null,
won smallint not null,
lost smallint not null,
primary key (matchno)
)
create table penalties(
paymentno integer not null,
playerno integer not null,
payment_date date not null,
amount decimal(7,2) not null,
primary key (paymentno)
)
create mittee_members(
playerno integer not null,
begin_date date not null,
end_date date,
position char(20),
primary key (playerno,begin_date)
)
。
insert into players values(2,'Everett','R','1948-09-01','M',1975,'Stoney Road','43','3575NH','Stratford','070-237893','2411');
insert into players values(7,'Wise','GWS','1963-05-11','M',1981,'be Way','39','9758VB','Stratford','070-347689',NULL);
insert into players values(8,'NewCastle','B','1962-07-08','F',1980,'Station Road','4','6584R0','Inglewood','070-458458','2983');
insert into players values(27,'Collins','DD','1964-12-28','F',1983,'Long Drive','804','8457DK