《实验训练3 数据增删改操作.docx》由会员分享,可在线阅读,更多相关《实验训练3 数据增删改操作.docx(27页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、【实验3-1】插入数据(1)使用单记录插入Insert语句分别完成汽车配件表Autoparts、商品类别表category、 用户表Client、用户类别表Clientkind、购物车表shoppingcart、订单表Order、订单明 细表order_has_Autoparts、评论Comment的数据插入,数据值自定;并通过select语句 检查插入前后的记录情况。Autoparts插入前Gi0l充京。I 版 I,零 I DonlUEReluct frowRxult Gnd | 强 Piter Rows:Edt: 造 峦 限 | Export/lmpott:尾| 色 Wrap 3 Come
2、ct, Jahot jxoduct SecondOass-sod BrandApri Apname eagejnkl imagejnk2 imageJnk3Introduction6 saie MjxicePnce Weight ts general vrtual nventory Inventory productve.year瑞玻 2 3 3 4 1 2 2 见将刷垫刷刷刷刷桁始培3 挡轮雨内雨雨雨雨抡轮脚H瑞玻 2 3 3 4 1 2 2 见将刷垫刷刷刷刷桁始培3 挡轮雨内雨雨雨雨抡轮脚Hxxxx XXXXXXXXX xxxx xxxx xxxx xxxx xxxx xxxx 乂 x X
3、xxxx XXX xxxx XXX xxxx xxxx xxxx xxxx xxxx xxxx 2222做后刷垫刷刷刷刷肛甑333档能雨由雨雨雨雨轮轮33B2.33 500.98 10.98230.00 10.5810.9810.9810.58310.98310.98 10.001.33 500.989.99230.89 9 9 9329.99329.994.9933232019-05-08 00:00:002019-08-09 00:00:002343402019-08-09 00:00:002019-09-09 00:00:00431231002019-08-09 00:00:002019
4、-09-09 00:00:001001112019-08-09 00:00:002019-09-09 00:00:001112222019-08-09 00:00:002019-08-09 00:00:0011112222019-08-09 00:00:002019-08-09 00:00:00nu2222019-08-09 00:00:002019-08-09 00:00:00ini2222019-08-09 00:00:002019-08-09 00:00:00ini2222019-08-09 00:00:002019-08-09 00:00:00mi2222019-08-09 00:00
5、:002019-08-09 00:00:00mi22222019-08-09 00:00:002019-08-09 00:00:002222皿Autoparts 插入1 insert into autoparts values( 31,前脚垫,xxxxx,xxxx,xxxxx”,前,物垫”,,5 : , , ,now(),now(),二,本日);|Autoparts插入后SQL File T autopans comment dierrt autopacts order shoppmgcart 后 ExpoV】goct:芋| a Wrap 3 Contort: Jahotjxoduct Sec
6、ondCis$5od BrandApid Apname rnagejnkl mageJWc2 nogejric3 Introductioin &_saR oldjxke Price Weight tsjgenerd vrtualjnventory Inventory productrve_yearX xxxx.xxTCXTCXXX.XX Exxx黑 gxxxxxx黑去皿 ExxxExxxg 黑黑2222翁 233R122M 233R122 廿 胞胎刷他刷刷刷刷IB始染凤殆刷虫刷刷刷刷加后垫脚口 曲轮雨眦雨雨雨雨轮轮脚挡轮雨眦雨雨雨雨轮轮眦前H 皿X xxxx.xxTCXTCXXX.XX Exx
7、x黑 gxxxxxx黑去皿 ExxxExxxg 黑黑2222翁 233R122M 233R122 廿 胞胎刷他刷刷刷刷IB始染凤殆刷虫刷刷刷刷加后垫脚口 曲轮雨眦雨雨雨雨轮轮脚挡轮雨眦雨雨雨雨轮轮眦前H 皿XXXXXXX xxxxXXX xxxx xxxx xxxx xxxx xxxx xxxx 2222 )OCXXXXX xxxxXXX xxxx xxxx xxxx xxxx xxxx xxxx 2222 xxxxx 匕对的刷总刷刷刷刷la 113233挡轮雨B1J雨雨雨雨轮轮33礴胎刷史刷刷刷刷!h:1H233牌g挡轮雨阴雨雨雨雨轮犯33前H12.331.330500.98S00.9811
8、0.989.990230.00230.00110.989.99110.989.99110.989.99110.989.991310.98329.991310.98329.99010.004 ,第12.331.330500.98S00.98110.989.9902X.00230.001打9.99110.989.99110.989.99110.989.991310.98329.991310.98329.99010.004.991599.00498.00012222222 O12222222M3 2340必1122络22122山22络2340以11022空纪22纪22仰皿 312222222 312
9、2222222 334312112222N22纪22山收 |2019-05-08 00:00:002019-08-09 00:00:002312019-08-09 00:00:002019-09-09 00:00:004322019-08-09 00:00:002019-09-09 00:00:0010012019-08-09 00:00:002019-09-09 00:00:0011122019-08-09 00:00:002019-08-09 00:00:00111112019-06-09 00:00:002019-08-09 00:00:00111112019-08-09 00:00:0
10、0201908-09 00:00:0011111002019-08-09 00:00:002019-08-09 00:00:00111112019-08-09 00:00:002019-08-09 00:00:00111122019-08-09 00:00:002019-08-09 00:00:00nn32019-06-09 00:00:002019-08-09 00:00:0022221002019-05-08 00:00:002019-08-09 00:00:002312019-08-09 00:00:002019-09-09 00:00:004322019-08-09 00:00:002
11、019-09-09 00:00:0010012019-06-09 00:00:002019-09-09 00:00:0011122019-06-09 00:00:002019-08-09 00:00:00mi12019-08-09 00:00:002019-08-09 00:00:00111112019-08-09 00:00:002019-08-09 00:00:00ini1002019-08X)9 00:00:002019)8-09 00:00:00111112019-08-09 00:00:002019-08-09 00:00:00111122019-08-09 00:00:002019
12、-08-09 00:00:00111132019-08-09 00:00:002019-08-09 00:00:0022221002019-11-30 21:21:112019-11-X 21:21:114331La3产牌户利牌牌牌牌牌婢F声牌产利牌牌牌牌牌牌3田n日马日古马马马马马马m日马日吉马马马马马马皿本皿auivpai loauivpai loauivpai loVIOI ivppi II F Q、O I 私 宅 I Doni bmrt I Y I 昼b Export/Impod; Xq| | Wrap Cel Content; EApid Apname kndgejrklimage
13、Jnk2 image Jnk3 Introducttoindd_pnce Price Weight tsjgeneral virtualjnventory Inventory pcoductive.year shdve.atehotjxoduct SecondClws.sdd Brand1档见碱璃XXXX2轮胎XXX3雨刷XXX4雌XXX5雨刷2XXX6雨刷3XXX7雨刷3XXX8雨刷4XXX9能的1XXX10陀的2XXX11雌2222212挡风城璃XXXX13轮胎XXX14雨刷XXX15雌XXX16雨刷2XXX17雨第3XXX18雨刷3XXX19雨刷4XXX20能的1XXX21陀的2XXX2
14、2触22222I-1XXXXXXXXXXXXX XXXX XXXX XXXX XXXXXXXXXXXX 八-X XXXXXXXXXXXXXJOOCX XXXX XXXX 500cx XXXXXXXX 八-X uimXXXX XXXXXXX XXXXXXX XXXX XXXX XXXX XXXX XXXX 2222 XXXX XXXXXXX XXXXXXX XXXX XXXX XXXX XXXX XXXX 2222 23挡风统搐陀胎雨刷(单只)由空2 .幻 500.98 10.98 230.00 10.98 10.98 10.98 10.98 310.98 310.98 10.00 2.3350
15、0.98 10.98230.00 10.98 10.98 10.98 10.98310.98 310.98 10.001.33500.989.99230.009.999.9.329.99329.994.99500.989.99230.00二二。9.99329.99329.994.99 匕1四,2133214311123311111122211222112221122211222112222122222133214311123311111122211222112221122211222112222122221口.,* iwilWH&232019-05-08 00:00:002019-08-09
16、00:00:0023402019-08-09 00:00:002019-09-09 00:00:00432019-08-09 00:00:002019-09-09 00:00:001002019-08-09 00:00:002019-09-09 00:00:001112019-08-09 00:00:002019-08-09 00:00:00mi2019-08-09 00:00:002019-O8-O9 00:00:00ini2019-08-09 00:00:002019-08-09 00:00:00mi2019-08-09 00:00:002019-08-09 00:00:001111201
17、9-08-09 00:00:002019-08-09 00:00:00ini2019-08-09 00:00:002019-08-09 00:00:00HU2019-08-09 00:00:002019-08-09 00:00:002222232019-05-08 00:00:002019-08-09 00:00:0023402019-03-09 00:00:002019-09-09 00:00:00431002019-08-09 00:00:002019-09X)9 00:00:001001112019-08-09 00:00:002019-O9-O9 00:00:001112222019-
18、08-09 00:00:002019-08-09 00:00:00mi2222019-08-09 00:00:002019-O8-O9 00:00:00mi2222019-08-09 00:00:002019-08-09 00:00:00mi2222019-08-09 00:00:002019-O8-O9 00:00:00ini2222019-08-09 00:00:002019-08-09 00:00:00ini2222019-08-09 00:00:002019-08-09 00:00:00mi22222019-08-09 00:00:002019-08-09 00:00:002222皿j
19、*忆阪1产牌声利牌牌出牌忠相日马日吉马马马马马马一产牌产利牌牌牌牌牌出口口日马日古马马马马马马工C23、订单表Order订单明细表【实验3-2】删除数据(1)使用Delete语句分别完成购物车表shoppingcartOrder_has_Autoparts评论Comment的数据删除,删除条件自定;并通过select语句检查 删除前后的记录情况。shoppingcart 删除前a sTf f A O IS l Oa sTf f A O IS l ODoni Limitselect *from shoppingcart;Result Grid 用Filter Rows:I Export:mgAu
20、toparts apidClient ddNumberadd time1123122221112123442222222222019-11-27 22:13:07 2019-11-27 22:13:48 2019-11-27 22:13:48 2019-11-27 22:13:48 2019-11-27 22:13:48 2019-11-27 22:13:48 2019-11-27 22:13:482019-11-27 22:13:48 2019-11-30 21:50:18shoppingcart 删除Query 1SQL Filerautopartscommentclientautopar
21、ts(H |H 9 O I Sil I O O 9 I Dont Umit与elect * from shoppingcart;id = 1delete from shoppingcart where autoshoppingcart 册U除后Query 1 xSQL Filerautopartscommentclientautoj17Autoparts_apidClient_ddNumberadd_time2122019-11-27 22:13:483222019-11-27 22:13:482222019-11-27 22:13:482322019-11-27 22:13:48242201
22、9-11-27 22:13:482422019-11-30 21:50:18Result Grid用a Alter Rows:| Export: 汩I Wrap Cell Doni Limitselect*from shoppingcart;Order删除前l O I S I O O 9 I Dont Limitselect * from shopping.order;OidStatusorder_dateClient_ddgoods_pricecarriagejxicetotal_pricetotal_weightDistribL1submi2019-09-09 00:00:0012.330
23、.002.332物流2submi2019-09-08 00:00:0019.990.009.992货到付:3submit2019-09-09 00:00:0029.990.009.992货到付:4submit2019-09-19 00:00:0029.990.009.992货到付:5submit2019-09-09 00:00:0029.990.009.992货到付;6submit2019-09-19 00:00:0039.990.0019.992货到付:7submit21999心 2019-09-09 00:00:009.990.0029.992货到付:8submit20 19-10-05
24、uu;uu;uuN9.990.009.992货到付:9submit2019-10-19 00:00:0029.990.009.992货到付;10submit2019-09-09 00:00:0029.990.009.992货到付: 1- A . A -AA A -A A AA AGA A AGAcXKT7.I ?上Wrap Cel Content:Edit:Result Grid 照 * Fitter Rows:亩 Export/Import:order_has_autoparts 册U除前select * from order ha与 autoparts;Result Grid 居 * Fi
25、lter Rov/s:Export: 3 Wrap Cell Content: JaAutoparts_apid Order_oid deal_price Numberreturn_number Time2619.991NULLnn 1Q.1 1.97cnZUZZ.Zz. DU2719.991NULLzuiy-ii-z/ ZZ.Z/.3U1819.991NULLzuzz.z/. du3919.991NULL2019-11-27 22:27:5011119.991NULL2019-11-27 22:27:5011219.991NULLzuiy-ii-z/ zz.z/.3U11319.991NUL
26、L2019-11-27 22:27:5041419.991NULL2019-11-27 22:27:5011019.991NULL2019-11-27 22:27:50114 | 10 |199,9912041588.002NULL2019-11-29 22:39:01NULL2019-11-30 22:01:43o rd e r_h a s_a uto pa rts 册lj 除I I45 select * from ordejhas autoparts;delBte from order has 日utoparts where order oid = 15;order_has_autopar
27、ts 册U除后4select * from order has auto 6 delete from order has autooarts where order oid =: I”.WUL |,WJLA |Order删除Order删除后彳 H I 9 9 A O I I O O H I Dont Limit I I f Gselect * from shopping.order;2delete from shopping.order where Oid = 15;4 I5 select * from order has autooarts:OidStatusorder_dateClient
28、_ddgoods_pric ecarriage_pricetotal_pric6submit2019-09-19 00:00:0039.990.0019.997submit2019-09-09 00:00:0049.990.0029.998submit2019-10-09 00:00:0029.990.009.999submit2019-10-19 00:00:C2019-10-19 00:00:000.009.9910submit2019-09-09 00:00:0u2y.yy0.009.9911submit2019-09-19 00:00:0029.990.009.9912submit20
29、19-09-09 00:00:0039.990.0019.9913submit2019-09-09 00:00:0049.990.0029.9914submit2019-09-09 00:00:0029.990.009.99 hullResult Grid 盘 Filter Rov/s:| Edit: 国 鼠| 匿3 | Export/Import:Comment删除前5 6 78 9select * from order_has_autoparts;select * from comment;delete fom order_has_autoparts whee order_oid =I E
30、dit:战CommentjdCommentsAutoparts_apidClient_dd5东西很好116不错不错127嗯继续好评118追评了129五星好评31Result GridFitter Rows:Comment 册lj除select * from comment;delete from commentcomn忙nt id = 5;Comment删除后select * from comment;delete from comment where comment id =msExportHmpcCommentjdCommentsAutoparts_apid Client_ddI Edit
31、:通Result Grid6不错不错127嗯继续好评118追评了129五星好评31O 2 Alter Rows:(2)使用TRUNCATE TABLE语句分别完成购物车表shoppingcart、评论Comment的数 据删除。1 HI贰打 U I 困 I - 3 I I uont umit1 2 34 5 TRUNCATE TABLE shoppingcart;TRUNCATE TABLE comment;select * from comment;Result Grid 照 Filter Rows:| Export:Wrap Cell Content: Jaselect * from sh
32、oppinecartAutoparts apidClient ddNumberadd time【实验3-3】修改数据使用Update分别完成汽车配件表Autoparts、商品类别表category、用户表Client、用户 类别表Clientkind、购物车表shoppingcart、订单表Order、订单明细表 Order_has_Autoparts评论Comment的数据修改,修改后数据值自定,修改条件自定; 并通过select语句检查修改前后的记录情况。Autoparts修改前 01/ 纠ISJIIDeOBIuontumit1 禽1JLllJ 回1 select * from Autop
33、arts;Result Grid 盘 Filter Rows:Edit:| Export/Irnport:| Wrap Cell Content: JaApid Apnameimage Jink 1image link2image link3Introductioinis saleold pricePrice Weight i:药 2 3 3凤胎刷垫刷刷刷挡抡雨脚雨雨雨XXXXXXXXXXXX挡风玻璃12.331.3321XXXXXXXXX轮胎0500.98500.9821XXXXXXXXXX雨刷(单只)110.989.9911XXXXXXXXX脚垫0230.00230.0031XXXXXXX
34、XXXX雨刷110.989.9911XXXXXXXXXXX雨刷110.989.9911XXXXXXXXXXX雨刷110.989.9911Autoparts 修改MM HUM I W JE,IIUD I I rtjl I 一、 I ” J J1 select * from Autoparts;updatB autoparts set apname =挡.风玻璃1-1 where 日pid = 1;Autoparts修改后图 H A O I I 9 9 M I Dont Umit I * I (select * from Autoparts;Execute the selected portion
35、 of the script or everything, if there is no seResult Grid 居 Filter Rows:Edit:亩o Export/Import:ApidApnameimagejink 1imagejink2image Ji nk3Introductioinis_sal1挡风玻璃1:1 XXXXXXXXXXXX挡风玻璃12轮胎 雨刷轮胎XXXXXX轮胎雨刷(单只)03xxXXXXXXX145脚垫雨刷2XXXXXXXXXXXXXXXXXXXX脚垫 雨刷01category修改前select * from category;Execute the selected portion of the script or everything, if tlR