当前位置:网站首页>问个sql view的问题
问个sql view的问题
2022-06-24 12:37:00 【CSDN问答】
有个sql问题但是不怎么懂怎么解, 希望有人帮我解答一下
问题是:
创建一个测试表和相应的视图以检查何时可以在视图中插入。 涵盖以下情况: (1) 视图不包含非默认 NOT NULL 和标准值; (2) 视图不包含整个primary key; (3) 视图基于跨越两个表的 JOIN 查询; (iv) 视图包含一个 GROUP BY 请求
其中2 不知道知道怎么弄
在这里先谢谢大家了
IF OBJECT_ID(N'Abt')is NULL
CREATE TABLE Abt (ANr int PRIMARY KEY, AbtName VARCHAR(20));
IF OBJECT_ID(N'Pers')is NULL
CREATE TABLE Pers (PNr int PRIMARY KEY, PName VARCHAR(40),AbtNrFK int);
ALTER TABLE Pers WITH CHECK ADD FOREIGN KEY(AbtNrFK)
REFERENCES Abt (ANr);
DELETE FROM Abt;
INSERT INTO Abt VALUES (1,'Einkauf');
INSERT INTO Abt VALUES (2,'Verkauf');
INSERT INTO Abt VALUES (3,'Vertrieb');
INSERT INTO Abt VALUES (4,NULL);
DELETE FROM Pers;
INSERT INTO Pers VALUES (1,'Mike Gent',3);
INSERT INTO Pers VALUES (2,'Alex Müller',2);
INSERT INTO Pers VALUES (3,'Leo Bauer',1);
INSERT INTO Pers VALUES (4,'Lena Bauer',2);
INSERT INTO Pers VALUES (5,'SARA Black',4);
INSERT INTO Pers VALUES (6,'David Simon',NULL);
INSERT INTO Pers VALUES (NULL,'Sam Schwarz',3);
CREATE VIEW TEST AS
SELECT PNr,PName,ANr,AbtName
FROM Pers join Abt on ANr=AbtNrFK
GROUP BY PNr,PName,AbtName;
边栏推荐
- [highlights] summary of award-winning activities of Tencent cloud documents
- 用一个软件纪念自己故去的母亲,这或许才是程序员最大的浪漫吧
- Use txvideoeditor to add watermark and export video card at 99%? No successful failed callback?
- Reset the password, and the automatic login of the website saved by chrome Google browser is lost. What is the underlying reason?
- WPF from zero to 1 tutorial details, suitable for novices on the road
- Essential key steps in the construction of e-commerce live broadcast source code
- Reading notes of returning to hometown
- About Adobe Photoshop adjusting selection
- Are you still working hard to select *? Then put away these skills
- go Cobra命令行工具入门
猜你喜欢
![[2022 national tournament simulation] BigBen -- determinant, Du Jiao sieve](/img/ec/6c6e3d878e2a05a6e7a4ca336ae134.jpg)
[2022 national tournament simulation] BigBen -- determinant, Du Jiao sieve

1、贪吃蛇游戏设计

几种常见的DoS攻击

go Cobra命令行工具入门

使用 Abp.Zero 搭建第三方登录模块(一):原理篇

About the hacked database

Detailed explanation of abstractqueuedsynchronizer, the cornerstone of thread synchronization

一文讲透植物内生菌研究怎么做 | 微生物专题

LVGL库入门教程 - 颜色和图像
![[data mining] final review (sample questions + a few knowledge points)](/img/90/a7b1cc2063784fb53bb89b29ede5de.png)
[data mining] final review (sample questions + a few knowledge points)
随机推荐
Implement Domain Driven Design - use ABP framework - create entities
Five minutes to develop your own code generator
物联网?快来看 Arduino 上云啦
我真傻,招了一堆只会“谷歌”的程序员!
手把手教你用AirtestIDE无线连接手机!
Configuration (enable_*) parameter related to execution plan in PG
Istio practical skills: implement header based authorization
16 safety suggestions from metamask project to solid programmers
SMS SMS
Cohere、OpenAI、AI21联合发布部署模型的最佳实践准则
Perhaps the greatest romance of programmers is to commemorate their dead mother with a software
105. simple chat room 8: use socket to transfer pictures
用一个软件纪念自己故去的母亲,这或许才是程序员最大的浪漫吧
Go basic series | 1 Leading
Use txvideoeditor to add watermark and export video card at 99%? No successful failed callback?
Google hacking search engine attack and Prevention
Design and implementation of high performance go log library zap
Babbitt | metauniverse daily must read: 618 scores have been announced. How much contribution has the digital collection made behind this satisfactory answer
Making daily menu applet with micro build low code
what the fuck! I'm flattered. He actually wrote down the answers to the redis interview questions that big companies often ask!