0 down vote favorite

I have a table:

    CREATE TABLE `student` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `name` varchar(100) NOT NULL,
      `score` int(11) NOT NULL,
      PRIMARY KEY (`id`)

Now i want to create a stored procedure that will insert new column into this table with the next id (which is automaticly created), name (value which I will write), and score (which i will write).

Quoted Text Here

I have tryed

    CREATE PROCEDURE insertStudent (IN name varchar(100),IN score int(11))
        insert into student (name,score) values (newName,newScore);

But it doesnt seem to work.

I know this is basic but i need help.

Recommended Answers

All 4 Replies

CREATE PROCEDURE insertStudent (IN newName varchar(100), IN newScore int(11))
    INSERT INTO student (name, score) VALUES (newName, newScore);

Your values should match your parameters.

It doesnt seem to work agin.
Am I using the right CALL

call insertstudent(John Doe, 75)

Oh Thanks for updating.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.