Path: utzoo!attcan!uunet!ncrlnk!ncrcae!scottj From: scottj@ncrcae.Columbia.NCR.COM (L. Scott Johnson) Newsgroups: comp.databases Subject: Re: Simple SQL question Keywords: SQL Message-ID: <5394@ncrcae.Columbia.NCR.COM> Date: 21 Nov 89 12:45:47 GMT References: <98813@ti-csl.csc.ti.com> Reply-To: scottj@ncrcae.Columbia.NCR.COM (L. Scott Johnson) Organization: NCR Corp., Engineering & Manufacturing - Columbia, SC Lines: 20 In article <98813@ti-csl.csc.ti.com> hemphill@ti.com (Charles Hemphill) writes: > >Can the following type of question be answered with an SQL expression? > > List the 10 oldest employees. > >Basically, I'd like the top N tuples from an ordered table. I don't >want to use embedded SQL. Since the table is ordered, you could use the following in ORACLE (which supplies a column called rownum, I'm not sure how or if other products offer this feature): select empname from emp where rownum <=10 Hope this helps (despite it's lack of generality) ---------- L. Scott