ch10.sql
来自「SQLServer2005基础教程_配套课件和脚本」· SQL 代码 · 共 47 行
SQL
47 行
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 + =
减小字号Ctrl + -
显示快捷键?