USE [pubs]
GO

/****** Object:  StoredProcedure [dbo].[byroyalty]    Script Date: 02/27/2009 09:36:49 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[byroyalty] @percentage int
AS
select au_id from titleauthor
where titleauthor.royaltyper = @percentage


GO


USE [pubs]
GO

/****** Object:  StoredProcedure [dbo].[reptq1]    Script Date: 02/27/2009 09:37:15 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[reptq1] AS
select pub_id, title_id, price, pubdate
from titles
where price is NOT NULL
order by pub_id
COMPUTE avg(price) BY pub_id
COMPUTE avg(price)


GO