samsteachyourselfSqlin24hours的范例表格Mysql版本。

来源:互联网 发布:node express视频教程 编辑:程序博客网 时间:2024/04/28 11:50
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

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

createdatebasestudy;
usestudy
--表employee_tbl结构

createtableemployee_tbl
(emp_idvarchar(9)notnull,

last_namevarchar(15)notnull,

first_namevarchar(15)notnull,

middle_namevarchar(15),

addressvarchar(30)notnull,

cityvarchar(15)notnull,

statechar(2)notnull,

zipnumeric(5)notnull,

phonechar(10),

pagerchar(10),

constraintemp_pkprimarykey(emp_id));

 

 

--表employee_pay_tbl结构
createtableemployee_pay_tbl
(emp_idvarchar(9)notnull,

positionvarchar(15)notnull,

date_hiredate,

pay_ratenumeric(4,2),

date_last_raisedate,

salarynumeric(8,2),

bonusnumeric(6,2),

constraintemp_fkforeignkey(emp_id)referencesemployee_tbl(emp_id));

 

 

--表customer_tbl结构
createtablecustomer_tbl
(cust_idvarchar(10)notnullprimarykey,

cust_namevarchar(30)notnull,

cust_addressvarchar(20)notnull,

cust_cityvarchar(15)notnull,

cust_statechar(2)notnull,

cust_zipnumeric(5)notnull,

cust_phonenumeric(10),

cust_faxnumeric(10));

 

 

 

--表orders_tbl结构
createtableorders_tbl
(ord_numvarchar(10)notnullprimarykey,

cust_idvarchar(10)notnull,

prod_idvarchar(10)notnull,

qtynumeric(6)notnull,

ord_datedate);

 

 

 

--表products_tbl结构
createtableproducts_tbl
(prod_idvarchar(10)notnullprimarykey,

prod_descvarchar(40)notnull,

costnumeric(6,2)notnull);

 

 

以下是各表的插入记录。

insertintoemployee_tblvalues

('311549902','STEPHENS','TINA','DAWN','RR3BOX17A','GREENWOOD',

'IN','47890','3178784465',NULL);

insertintoemployee_tblvalues

('442346889','PLEW','LINDA','CAROL','3301REACON','INDIANAPOLIS',

'IN','46224','3172978990',NULL);

insertintoemployee_tblvalues

('213764555','GLASS','BRANDON','SCOTT','1710MAINST','WHITELAND',

'IN','47885','3178984321','3175709980');

insertintoemployee_tblvalues

('313782439','GLASS','JACOB',NULL,'3789WHITERIVERBLVD',

'INDIANAPOLIS','IN','45734','3175457676','8887345678');
insertintoemployee_tblvalues

('220984332','WALLACE','MARIAH',NULL,'7889KEYSTONEAVE',

'INDIANAPOLIS','IN','48741','3173325986',NULL);
insertintoemployee_tblvalues

('443679012','SPURGEON','TIFFANY',NULL,'5GEORGECOURT',

'INDIANAPOLIS','IN','46234','317569007',NULL);

 

insertintoemployee_pay_tblvalues

('311549902','MARKETING','1989-05-23',NULL,'1997-05-01','40000',NULL);


insertintoemployee_pay_tblvalues

('442346889','TEAMLEADER','1990-06-17','14.75','1997-06-01',NULL,NULL);

insertintoemployee_pay_tblvalues

('213764555','SALESMANAGER','1994-08-14',NULL,'1997-08-01','30000','2000');
insertintoemployee_pay_tblvalues

('313782439','SALESMAN','1997-06-28',NULL,NULL,'20000','1000');

insertintoemployee_pay_tblvalues

('220984332','SHIPPER','1996-07-22','11.00','1997-07-01',NULL,NULL);1

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击