create table sailors (sid smallint not null primary key unclustered,
	sname char(10), rating tinyint, age smallint)

create clustered index sname_index on sailors (sname)



create table reserves (sid smallint NOT NULL references sailors (sid),
	bid smallint not null, day smalldatetime, rname char(10))

alter table reserves add primary key (sid, bid)

create index rname_index on reserves (rname)



insert into sailors values (1, 'Ishmael', 7, 31)
insert into sailors values (2, 'Ahab', 7, 35)
insert into sailors values (3, 'Queequeg', 7, 22)
insert into sailors values (4, 'Dagoo', 7, 33)
insert into sailors values (5, 'Tashtego', 7, 19)
insert into sailors values (6, 'Nelson', 7, 56)
insert into sailors values (7, 'Odysseus', 7, 135)
insert into sailors values (8, 'Fred', 7, 35)
insert into sailors values (9, 'Nimitz', 7, 41)
insert into sailors values (10, 'Zeke', 7, 34)

select S.* from sailors S where S.age > 40



create table heapfile (f1 int primary key nonclustered, f2 int)

create nonclustered index f1_index on heapfile (f2)



insert into heapfile values (1, 2)
insert into heapfile values (3, 4)

select * from heapfile



select S.* from sailors S where S.sname < 'M%'



select S.* from sailors S order by S.sname asc



select S.* from sailors S order by S.age desc



select S.* from sailors S order by S.sid asc



select S.* from sailors S where S.sname = 'Zeke'



select S.* from sailors S where S.sid = 1
