⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch10.sql

📁 SQLServer2005基础教程,清华大学出版社
💻 SQL
字号:
USE AdventureWorks
GO 
CREATE VIEW vw_EmpHireDate(EmployeeName, EmployeeID, HireDate)
AS 
SELECT c.FirstName + ' ' + c.LastName, e.EmployeeID, e.HireDate
FROM HumanResources.Employee e JOIN Person.Contact c 
ON e.ContactID = c.ContactID
GO
SELECT *
FROM vw_EmpHireDate

USE AdventureWorks
sp_helptext vw_EmpHireDate

USE AdventureWorks
GO
CREATE VIEW vw_EmpHireDate_Encrypted(EmployeeName, EmployeeID, HireDate)
WITH ENCRYPTION
AS 
SELECT c.FirstName + ' ' + c.LastName, e.EmployeeID, e.HireDate
FROM HumanResources.Employee e JOIN Person.Contact c 
ON e.ContactID = c.ContactID
GO
sp_helptext vw_EmpHireDate_Encrypted

USE AdventureWorks
IF OBJECT_ID('vw_EmpHireDate_Encrypted', 'VIEW') IS NOT NULL
	DROP VIEW vw_EmpHireDate_Encrypted

USE AdventureWorks
GO
CREATE VIEW vw_young_employees
AS
SELECT EmployeeID, BirthDate
FROM HumanResources.Employee
WHERE BirthDate > '1980-1-1'
WITH CHECK OPTION


USE AdventureWorks
SELECT *
FROM vw_young_employees

USE AdventureWorks
UPDATE vw_young_employees
SET BirthDate = '1972-1-1'
WHERE EmployeeID = 99

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -