落伍者站长论坛's Archiver

measi 发表于 2008-5-12 17:57

关于SQL server2000创建试图代码的问题!

原代码是这样的:
use university
go
create view class_Nview
as
select DISTINCT TOP 20 PERCENT
class1.name AS 姓名,
class1.xh as 学号,
class1.csrq as 出生日期,
class2.room as 寝室号,
from class inner jion
ON class2 class1.xh=class2.xh
GO
(1)现在请问:select DISTINCT TOP 20 PERCENT是什么意思?有什么意义?
(2)请问:from class inner jion 这句又是什么意思?有什么意义?
(3)请问:ON class2 class1.xh=class2.xh又是什么意思?
请哪为高手指教指教,谢谢了!

ciama 发表于 2008-5-12 17:58

select DISTINCT TOP 20 PERCENT 这个是取的表中的所有记录的前20条记录,from class inner jion 这个是表class 内联接表class2 :ON class2 class1.xh=class2.xh 这个是表class和表class2连接的条件,建议你先学习下数据库原理中的表连接,这是基本的一个内联接的查询语句。

idcwang 发表于 2008-5-12 18:08

楼上正解

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.