employee_view.sql

来自「一个基本的酒店管理系统」· SQL 代码 · 共 40 行

SQL
40
字号
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'V' AND name = 'Employee_view')
	BEGIN
		PRINT 'Dropping View Employee_view'
		DROP  View Employee_view
	END
GO

/******************************************************************************
**		File: 
**		Name: Employee_view
**		Desc: 
**
**		This template can be customized:
**              
**
**		Auth: 
**		Date: 
*******************************************************************************
**		Change History
*******************************************************************************
**		Date:		Author:				Description:
**		--------		--------				-------------------------------------------
**    
*******************************************************************************/

PRINT 'Creating View Employee_view'
GO
CREATE View Employee_view
as

select eid,ename,echar,esex,eage,(select ttype from typeroom where typeroom.tid= employeeinfo.tid)as type,(select Grade from GradeInfo where  GradeInfo.GradeID=employeeinfo.gradeid)as grade,ecardid,ejoin from employeeinfo


GO


GRANT SELECT ON Employee_view TO PUBLIC

GO

⌨️ 快捷键说明

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