Jump to content

Stored Procedure


yrstruly
 Share

Recommended Posts

I have a table: Named  HighScores  

"INSERT HighScores 
VALUES ('Bob', 2500, '2 Jan 2013 13:13'),
           ('Jon', 1500, '2 Jan 2013 13:15'),
       ('Amy', 3500, '2 Jan 2013 13:18')"

I want to create a stored procedure that would:

The score must show the TOP 5 or so people.

Show your position on the high score board

Show the person in front and below you on the high score board.

If the scores are tied, the person who got it the most recent is shown higher.

Can anybody assist me please?

Link to comment
Share on other sites

  • 3 months later...

It doesn't work for MySQL Workbench:

CREATE PROCEDURE SelectAllCustomersAS
SELECT * FROM Customers
GO;
EXEC SelectAllCustomers;

But it is working:

DELIMITER //

CREATE PROCEDURE SelectCategory()
BEGIN
    SELEC
T * FROM category;
END //

CALL SelectCategory();    

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...