Question: I need to create a stored procedure that will be used to show the top student records based on gpa. An input parameter should be

I need to create a stored procedure that will be used to show the top student records based on gpa. An input parameter should be used to indicate the number of records to return...

I need to be able to execute exec spTopGPA(3) should return the top 3 student records based on gpa. I don't have to use ties. but ,I have to use dynamic sql and use the follow table schema.

CREATE TABLE [dbo].[student]( [StudentID] [int] IDENTITY(1,1) NOT NULL, [Firstname] [varchar](50) NOT NULL, [Lastname] [varchar](50) NOT NULL, [SS#] [int] NOT NULL, [GPA] [int] NOT NULL, PRIMARY KEY CLUSTERED ( [StudentID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY], UNIQUE NONCLUSTERED ( [SS#] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO ALTER TABLE [dbo].[student] WITH CHECK ADD CHECK (([GPA]>=(0))) GO

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!