首页 > 数据库 > MySQL > 正文

sams teach yourself Sql in 24hours的范例数据库表格Mysql版本。

2024-07-24 12:54:57
字体:
来源:转载
供稿:网友

商业源码热门下载www.html.org.cn


想找个范例的数据库原来真不是简单。呵呵
原书本上的数据库只是个标准,不是实现的版本。
在网上艰辛地找到了这个表格之后与发现自已用的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') ;
insert into customer_tbl values

('21','morgans candies and treats','5657 w tenth st',

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

insert into customer_tbl values

('43','schylers novelties','17 maple st','lebanon','in',

'48990','3174346758',null) ;

insert into customer_tbl values

('288','hollys gamearama','567 us 31 south','whiteland',

'in','49980','3178879023',null) ;
insert into customer_tbl values

('287','gavins place','9880rockville rd','indianapolis',

'in','46244','3172719991','3172719992') ;
insert into customer_tbl values

('590','heathers feathers and things','4090 n shadeland ave',

'indianapolis','in','43278','3175456768',null) ;

insert into customer_tbl values

('610','ragans hobbies inc','451 green st','plainfield','in',

'46818','3178393441','3178399090') ;

insert into customer_tbl values

('560','andys candies','rr 1 box 34','nashville','in',

'48756','8123239871',null) ;

insert into customer_tbl values

('221','ryans stuff','2337 s shelby st','indianapolis','in',

'47834','3175634402',null) ;


insert into orders_tbl values

('56a901','232','11235','1','1997-10-22') ;


insert into orders_tbl values

('56a917','12','907','100','1997-09-30') ;


insert into orders_tbl values

('32a132','43','222','25','1997-10-10') ;


insert into orders_tbl values

('16c17','090','222','2','1997-10-17') ;

insert into orders_tbl values

('18d778','287','90','10','1997-10-17') ;

insert into orders_tbl values

('23e934','432','13','20','1997-10-15') ;


insert into products_tbl values

('11235','witches costume','29.99') ;

insert into products_tbl values

('222','plastic pumpkin 18 inch','7.75') ;

insert into products_tbl values

('13','false paraffin teeth','1.10') ;


insert into products_tbl values

('90','lighted lanterns','14.50') ;

insert into products_tbl values

('15','assorted costumes','10.00') ;

insert into products_tbl values

('9','candy corn','1.35') ;


insert into products_tbl values

('6','pumpkin candy','1.45') ;

insert into products_tbl values

('87','plastic spiders','1.05') ;

insert into products_tbl values

('119','assorted masks','4.95') ;


 
上一篇:MySQL数据类型

下一篇:MYSQL4.1版本的问题

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表