数据库三道简答题 数据库简答题
sql\u6570\u636e\u5e93\u8fd9\u4e09\u9053\u9898\u5e94\u8be5\u600e\u4e48\u505a\uff1f\u6ce8\u610f\uff1a\u5c0f\u5199\u7684\u5b57\u6bcd\u4e3a\u8868\u7684\u522b\u547d\u540d\uff0c\u5b57\u6bb5\u5927\u5c0f\u5199\u6ca1\u6709\u533a\u5206\uff0c\u4f60\u8981\u662f\u533a\u5206\u7684\u8bdd\u533a\u5206\u4e0b\uff0csql \u67e5\u8be2\u5668\u91cc\u9762\u53ef\u4ee5\u8bbe\u7f6e
\u67e5\u8be2\u8ba2\u5355\u91d1\u989d\u6700\u9ad8\u7684\u5ba2\u6237\u540d\u3001\u8d27\u54c1\u540d\u79f0\u3001\u8d2d\u4e70\u6570\u91cf\u3001\u91d1\u989d\u548c\u4e0b\u5355\u65f6\u95f4\u3002
select c.cname \u5ba2\u6237\u540d ,p.pname \u8d27\u54c1\u540d\u79f0,o.quantity \u8d2d\u4e70\u6570\u91cf,max(o.money) \u91d1\u989d\uff0co.orderdate \u4e0b\u5355\u65f6\u95f4
from Customer c,Product p, Orders o
where c.cid=o.cid and o.oid=p.pid
2.\u67e5\u8be2\u5e93\u5b58\u91cf\u4f4e\u4e8e10\u7684\u5546\u54c1\u540d\u79f0
select p.pname \u8d27\u54c1\u540d\u79f0
from Product p
where p.quantity<10
3.
\u5047\u8bbe\u8ba2\u5355\u8868Orders\u5df2\u521b\u5efa\uff0c\u4e3a\u8be5\u8868\u6dfb\u52a0\u9ed8\u8ba4\u503c\u7ea6\u675f\uff0c\u8ba2\u5355\u65e5\u671f\u4e3a\u5f53\u524d\u65e5\u671f
Alter table Orders Alter Column \u8ba2\u5355\u65e5\u671f datetime default getdate()
Insert into student ('number','name','age','sex') value ('1','\u5f20\u4e09'\uff0c'18','1');
\u683c\u5f0f insert into \u8868\u540d (\u5217\u540d) value (\u503c)
数据模型的三要素
1、概念数据模型(Conceptual Data Model)
2、逻辑数据模型(Logical Data Model)
3、物理数据模型(Physical Data Model)
自己找书展开
2.delete是删除记录操作,如果数据有日志,在删除的同时会记录在日志中,drop table 是删除整个表机构,比如一个几百万行带日志库表,你用delete删除这个表可能要花几十分钟来写日志,如果你用drop talbe只是瞬间的事
3. on delete cascade
on delete no action
on delete set null
对应完整性应对方式,具体应用网络查看资料
基础的概念题,楼上各位很不专业啊
1。有ER模型和类模型
2。delete是删除表,drop table是修改表
3。基本表约束,断言,域定义
绛旓細杩欎釜琛ㄧ殑璁捐杩濆弽浜嗕笁澶ц寖寮忥紝閫犳垚浜鏁版嵁鍐椾綑璺熺淮鎶ょ殑涓嶄究銆傛纭殑璁捐鏂瑰紡搴旇鏄細椤惧琛細椤惧鍙 | 椤惧濮撳悕 ---|--- CR76 | 寮犲ぇ ---|--- CR56 | 寮犱簩 鎴夸富琛細鎴夸富鍙 | 鎴夸富鍚 ---|--- C040 | 鐜嬪ぇ ---|--- C093 | 鐜嬩簩 鎴夸骇琛細鎴夸骇鍙 | 鎴夸骇鍦板潃 | 鎴夸富...
绛旓細3銆丷eplace鍛戒护涓渷鐣<鑼冨洿>锛岄粯璁ゅ锛 褰撳墠璁板綍 锛 杩涜鎿嶄綔 4銆佸湪瀛︾敓鏁版嵁搴涓紝骞撮緞瀛楁涓篘鍨嬶紝鏍囧織瀛楁涓篖鍨嬶紝璇峰~绌猴細use瀛︾敓 index on 骞撮緞 to idx 2 灏嗚褰曟寚閽堝畾浣嶅湪绗竴涓勾榫勬槸20鐨勮褰曚笂锛屽簲浣跨敤鍛戒护锛坰elect * from idx2 where 骞撮緞=20 锛夋樉绀烘墍鏈夊勾榫勪负20鐨勫鐢熻褰曪紝搴斾娇鐢ㄥ懡浠...
绛旓細C璇█鍜鏁版嵁搴鐨勫崰姣斾负55寮,鍧囦负75鍒嗐備粖骞寸湡棰樼殑棰樺瀷鍒嗗竷璁剧疆涓庡線骞翠笉鍚,寰骞翠负涓ら棬璇剧洰娣风潃涓璧,浠婂勾鏀逛负浜嗙涓閮ㄥ垎涓篊璇█,绗簩閮ㄥ垎涓烘暟鎹簱; C璇█鐨勯鍨嬬殑绗竴閮ㄥ垎閫夋嫨棰,杩欓儴鍒嗕富瑕佽冩煡鐭ヨ瘑鐐硅蹇,绗簩閮ㄥ垎涓轰唬鐮佸~绌,杩欓儴鍒嗕富瑕佽冩煡浠g爜鐞嗚В,绗笁閮ㄥ垎涓绠绛旈,涓庡線骞翠笉鍚,浠婂勾鐨勭畝绛旈绗竴閬撹冪殑...
绛旓細涓銆鏁版嵁搴鐨勫叧绯昏瘝鎶曞奖鍜岄夋嫨鐨勫尯鍒湪浜庯細1銆佷袱鑰呭鏁版嵁鐨勭粨鏋滀笉鍚岋細鎶曞奖鐨勭粨鏋滄槸涓涓睘鎬у垪鎴栧涓睘鎬у垪鏁版嵁銆傞夋嫨鐨勭粨鏋滄槸涓琛岋紙鍏冪粍锛夋垨澶氳鏁版嵁銆2銆佷袱鑰呯殑瀵规暟鎹殑瑕佹眰涓嶅悓锛氭姇褰遍渶瑕佸彇鎸囧畾鐨勬暟鎹傞夋嫨闇瑕佸彇婊¤冻鏉′欢鐨勬暟鎹備簩銆佺涓夐鍙互杩欎箞鐞嗚В锛氳繖閲屾湁涓寮犺〃鏍糞锛屾湁杩欎簺鍒楋細鎬у埆锛屽鍙凤紝...
绛旓細闂涓锛氳姹備笉娓呮櫚锛屽熶功鍜岃繕涔﹁繖涓姹備笉鏄庣‘ 闂浜岋細select b.books_name,c.user_name from lease a, books b, user c where a.books_ID=b.books_ID and a.user_ID=c.user_ID and loan_date between '2006-07-02' and '2007-07-05'闂涓夛細select b.books_name,c.user_name fro...
绛旓細Visual FoxPro闈㈠悜瀵硅薄鐨勫紑鍙戠幆澧冧娇寰楁棤璁烘槸缁勭粐淇℃伅銆佽繍琛屻佹煡璇佸垱寤洪泦鎴愮殑鍏崇郴鍨鏁版嵁搴绯荤粺锛岃繕鏄紪鍐欐暟鎹簱绠$悊搴旂敤绋嬪簭锛岄兘鍙樺緱鍗佸垎杞绘澗銆備笁绾ф暟鎹簱锛氭暟鎹簱绯荤粺鐨勫熀鏈師鐞 1锛 鏁版嵁搴撶殑鍩烘湰姒傚康锛屾暟鎹簱绯荤粺鐨勬瀯鎴愩2锛 鏁版嵁搴撴ā鍨嬫蹇靛拰涓昏鐨勬暟鎹ā鍨嬨3锛 鍏崇郴鏁版嵁妯″瀷鐨勫熀鏈蹇碉紝鍏崇郴鎿嶄綔鍜屽叧绯...
绛旓細CREATE TABLE 鐮旂┒浜哄憳 (浜哄憳缂栧彿 int PRIMARY KEY, 濮撳悕 CHAR(8), 骞撮緞 SMALLINT CHECK(骞撮緞<=35), 鑱岀О CHAR(8) CHECK(鑱岀О IN(鈥樿甯堚,鈥樺壇鏁欐巿鈥,鈥樻暀鎺堚)) ); CREATE TABLE 椤圭洰 (椤圭洰缂栧彿 int PRIMARY KEY, 鍚嶇О CHAR(20), 璐熻矗浜虹紪鍙 INT, 绫诲埆 CHAR(8), FOREIGN KEY(璐熻矗浜...
绛旓細where a.cno = '1' --鏁版嵁搴 璇剧▼浠g爜 group by b.Sdept --3銆佹煡璇㈣嚦灏戦変慨浜嗗鐢焥1閫変慨鐨勫叏閮ㄨ绋嬬殑瀛︾敓鍙风爜 select distinct a.Sno from SC a where a.Sno <> '001' --浠001浠h〃瀛︾敓S1鐨勭紪鍙 and not exists (select from SC b where b.Sno = '001'and not exists (select 1 f...
绛旓細瀵逛笉璧凤紝涓嶄細
绛旓細--鏌ヨ鎵鏈夎绋嬪垎鏁伴兘鍦60鍒嗕互涓婄殑瀛︾敓鎵鏈夋垚缁﹕elect 濮撳悕,璇剧▼,鍒嗘暟 from 鎴愮哗琛╳here 濮撳悕 in (select 濮撳悕 from 鎴愮哗琛 group by 濮撳悕 having min(鍒嗘暟) >= 60)--鎵ц涓涓垹闄よ鍙,褰揘ame鍒椾笂鏈夌浉鍚屾椂,鍙繚鐣橧D杩欏垪涓婂煎皬鐨.delete from team where id not in (select min(id) from ...