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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started