sam's teach yourself Sql in 24hours的范例数据库表格Mysql版本。[1]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 bbmyth 的 blog

想找个范例的数据库原来真不是简单。呵呵
原书本上的数据库只是个标准,不是实现的版本。
在网上艰辛地找到了这个表格之后与发现自已用的mysql字段的类型不符。
于是做了改动。下面的sql文件可以直接导入mysql了。
有了这个东东。可以节省很多输入的时间。学习更方便了。
--study.sql文件如下:

create datebase study;
use study
--表employee_tbl结构

create table employee_tbl
(emp_id varchar(9) not null,

last_name varchar(15) not null,

first_name varchar(15) not null,

middle_name varchar(15),

address varchar(30) not null,

city varchar(15) not null,

state char(2) not null,

zip numeric(5) not null,

phone char(10),

pager char(10),

constraint emp_pk primary key(emp_id) );

 

 

--表employee_pay_tbl结构
create table employee_pay_tbl
(emp_id varchar(9) not null,

position varchar(15) not null,

date_hire date,

pay_rate numeric(4,2),

date_last_raise date,

salary numeric(8,2),

bonus numeric(6,2),

constraint emp_fk foreign key(emp_id) references employee_tbl(emp_id) );

 

 

--表customer_tbl结构
create table customer_tbl
(cust_id varchar(10) not null primary key,

cust_name varchar(30) not null,

cust_address varchar(20) not null,

cust_city varchar(15) not null,

cust_state char(2) not null,

cust_zip numeric(5) not null,

cust_phone numeric(10),

cust_fax numeric(10) );

 

 

 

--表orders_tbl结构
create table orders_tbl
(ord_num varchar(10) not null primary key,

cust_id varchar(10) not null,

prod_id varchar(10) not null,

qty numeric(6) not null,

ord_date date );

 

 

 

--表products_tbl结构
create table products_tbl
(prod_id varchar(10) not null primary key,

prod_desc varchar(40) not null,

cost numeric(6,2) not null );

 

 

以下是各表的插入记录。

insert into employee_tbl values

('311549902','stephens','tina','dawn','rr 3 box 17a','green wood',

'in','47890','3178784465',null) ;

insert into employee_tbl values

('442346889','plew','linda','carol','3301 reacon','indianapo lis',

'in','46224','3172978990',null) ;

insert into employee_tbl values

('213764555','glass','brandon','scott','1710 main st','whiteland',

'in','47885','3178984321','3175709980') ;

insert into employee_tbl values

('313782439','glass','jacob',null,'3789 white river blvd',

'indianapolis','in','45734','3175457676','8887345678') ;
insert into employee_tbl values

('220984332','wallace','mariah',null,'7889 keystone ave',

'indianapolis','in','48741','3173325986',null) ;
insert into employee_tbl values

('443679012','spurgeon','tiffany',null,'5 george court',

'indianapolis','in','46234','317569007',null) ;

 

insert into employee_pay_tbl values

('311549902','marketing','1989-05-23',null,'1997-05-01','40000',null) ;


insert into employee_pay_tbl values

('442346889','team leader','1990-06-17','14.75','1997-06-01',null,null) ;

insert into employee_pay_tbl values

('213764555','sales manager','1994-08-14',null,'1997-08-01','30000','2000') ;
insert into employee_pay_tbl values

('313782439','salesman','1997-06-28',null,null,'20000','1000');

insert into employee_pay_tbl values

('220984332','shipper','1996-07-22','11.00','1997-07-01',null,null) ;

insert into employee_pay_tbl values

('443679012','shipper','1991-01-14','15.00','1997-01-01',null,null) ;

insert into customer_tbl values

('232','leslte gleason','798 hardaway dr','indianapolis',

'in','47856','3175457690',null) ;

insert into customer_tbl values

('109','nancy bunker','apt a 4556 waterway','broad ripple',

'in','47950','3174262323',null) ;

insert into customer_tbl values

('345','angela dobko','rr3 box 76','lebanon','in','49967',

'7858970090',null) ;


insert into customer_tbl values

('090','wendy wolf','3345 gateway dr','indianapolis','in',

'46224','3172913421',null) ;

insert into customer_tbl values

('12','marys gift shop','435 main st','danville','il','47978',

'3178567221','3178523434') ;

insert into customer_tbl values

('432','scott market','rr2 bdx 173','brownsburg','in',

'45687','3178529835','3178529836') ;

insert into customer_tbl values

('333','jasdns and dallas goodies','lafayette sq mall',

'indianapolis','in','46222','3172978886','3172978887') ;

本文关键:sam's teach yourself Sql in 24hours的范例数据库表格Mysql版本。
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top