仓酷云
标题:
MYSQL网页编程之sams teach yourself Sql in 24hours的...
[打印本页]
作者:
只想知道
时间:
2015-1-16 22:44
标题:
MYSQL网页编程之sams teach yourself Sql in 24hours的...
无疑希望员工得到系统、有深度的培训,显然MySQL在这一点上还做得很不够。mysql|数据|数据库
想找个典范的数据库本来真不是复杂。呵呵
原书籍上的数据库只是个尺度,不是完成的版本。
在网上艰苦地找到了这个表格以后与发明自已用的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);
insertintoemployee_pay_tblvalues
(443679012,SHIPPER,1991-01-14,15.00,1997-01-01,NULL,NULL);
insertintocustomer_tblvalues
(232,LESLTEGLEASON,798HARDAWAYDR,INDIANAPOLIS,
IN,47856,3175457690,NULL);
insertintocustomer_tblvalues
(109,NANCYBUNKER,APTA4556WATERWAY,BROADRIPPLE,
IN,47950,3174262323,NULL);
insertintocustomer_tblvalues
(345,ANGELADOBKO,RR3BOX76,LEBANON,IN,49967,
7858970090,NULL);
insertintocustomer_tblvalues
(090,WENDYWOLF,3345GATEWAYDR,INDIANAPOLIS,IN,
46224,3172913421,NULL);
insertintocustomer_tblvalues
(12,MARYSGIFTSHOP,435MAINST,DANVILLE,IL,47978,
3178567221,3178523434);
insertintocustomer_tblvalues
(432,SCOTTMARKET,RR2BDX173,BROWNSBURG,IN,
45687,3178529835,3178529836);
insertintocustomer_tblvalues
(333,JASDNSANDDALLASGOODIES,LAFAYETTESQMALL,
INDIANAPOLIS,IN,46222,3172978886,3172978887);
insertintocustomer_tblvalues
(21,MORGANSCANDIESANDTREATS,5657WTENTHST,
INDIANAPOLIS,IN,46234,3172714398,NULL);
insertintocustomer_tblvalues
(43,SCHYLERSNOVELTIES,17MAPLEST,LEBANON,IN,
48990,3174346758,NULL);
insertintocustomer_tblvalues
(288,HOLLYSGAMEARAMA,567US31SOUTH,WHITELAND,
IN,49980,3178879023,NULL);
insertintocustomer_tblvalues
(287,GAVINSPLACE,9880ROCKVILLERD,INDIANAPOLIS,
IN,46244,3172719991,3172719992);
insertintocustomer_tblvalues
(590,HEATHERSFEATHERSANDTHINGS,4090NSHADELANDAVE,
INDIANAPOLIS,IN,43278,3175456768,NULL);
insertintocustomer_tblvalues
(610,RAGANSHOBBIESINC,451GREENST,PLAINFIELD,IN,
46818,3178393441,3178399090);
insertintocustomer_tblvalues
(560,ANDYSCANDIES,RR1BOX34,NASHVILLE,IN,
48756,8123239871,NULL);
insertintocustomer_tblvalues
(221,RYANSSTUFF,2337SSHELBYST,INDIANAPOLIS,IN,
47834,3175634402,NULL);
insertintoorders_tblvalues
(56A901,232,11235,1,1997-10-22);
insertintoorders_tblvalues
(56A917,12,907,100,1997-09-30);
insertintoorders_tblvalues
(32A132,43,222,25,1997-10-10);
insertintoorders_tblvalues
(16C17,090,222,2,1997-10-17);
insertintoorders_tblvalues
(18D778,287,90,10,1997-10-17);
insertintoorders_tblvalues
(23E934,432,13,20,1997-10-15);
insertintoproducts_tblvalues
(11235,WITCHESCOSTUME,29.99);
insertintoproducts_tblvalues
(222,PLASTICPUMPKIN18INCH,7.75);
insertintoproducts_tblvalues
(13,FALSEPARAFFINTEETH,1.10);
insertintoproducts_tblvalues
(90,LIGHTEDLANTERNS,14.50);
insertintoproducts_tblvalues
(15,ASSORTEDCOSTUMES,10.00);
insertintoproducts_tblvalues
(9,CANDYCORN,1.35);
insertintoproducts_tblvalues
(6,PUMPKINCANDY,1.45);
insertintoproducts_tblvalues
(87,PLASTICSPIDERS,1.05);
insertintoproducts_tblvalues
(119,ASSORTEDMASKS,4.95);
有的时候,一些缺失的功能可以通过别的办法来实现,例如,在MySQL4.1以前,你可以通过使用join方法来替代子查询的功能。在MySQL5.0中,大多数关系型数据库所要求的功能已经都具备。
作者:
小妖女
时间:
2015-1-19 22:18
大侠们有推荐的书籍和学习方法写下吧。
作者:
分手快乐
时间:
2015-1-25 20:46
这就引发了对varchar和char效率讨论的老问题。到底如何分配varchar的数据,是否会出现大规模的碎片?
作者:
只想知道
时间:
2015-2-3 22:16
而写到本地,我又考虑到效率问题.大家来讨论讨论吧,分数不打紧,就给10分,十全十美,没啥对错,各抒己见,但是要有说服力的哦~
作者:
透明
时间:
2015-2-9 05:49
但换公司用MSSQL2K感觉自己好像根本就不了解MSSQL。什么DTS触发器以前根本没用过。
作者:
不帅
时间:
2015-2-27 02:16
不过话说回来了,绝大多数的性能优化准则与对sqlserver存储的结构理解息息相关
作者:
仓酷云
时间:
2015-3-8 19:09
sqlserver的痛苦之处在于有用文档的匮乏,很多只是表明的东西
作者:
admin
时间:
2015-3-16 12:25
呵呵,这就是偶想说的
作者:
深爱那片海
时间:
2015-3-22 23:01
原来的计算字段其实和虚拟字段很像。只是管理方面好了而已,性能方面提高不多。但是SQL2005提供了计算字段的持久化,这就提高了查询的性能,但是会加重insert和update的负担。OLTP慎用。OLAP可以大规模使用。
欢迎光临 仓酷云 (http://ckuyun.com/)
Powered by Discuz! X3.2