Question

Using the Class database, answer the following questions: 1. Create a stored procedure that for any...

Using the Class database, answer the following questions:

1. Create a stored procedure that for any student id entered, a list of absences for that

student will be displayed. Display the student id, student name, and the dates the

student has missed. Display the total number of days missed for this student. Name

this stored procedure

StudentAbsences

.

a. What did you write for your stored procedure? Insert the snip of the contents of the

stored procedure here:

b. Run your stored procedure for student 17. Insert your snip showing your stored

procedure call and results here:

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Stored procedure :

DELIMITER //
CREATE PROCEDURE StudentAbsences( IN studentID int)
BEGIN
select student.student_id , name,date,count(date) as ' Missed days' from student,absence where
student.student_id=absence.student_id and student.student_id=studentID group by student.student_id , name;
END //
DELIMITER ;

Executing stored procedure :

call StudentAbsences(17);

Explanation :

  • Stored procedure is compile only once and when call every time it will execute.
  • Above stored procedure will join two table student and absence based on student_id
  • and will return the details for the passed student id as 17
Add a comment
Know the answer?
Add Answer to:
Using the Class database, answer the following questions: 1. Create a stored procedure that for any...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • How can I create the following stored procedure in MySQL Workbench?: Create a stored procedure na...

    How can I create the following stored procedure in MySQL Workbench?: Create a stored procedure named prc_new_rental to insert new rows in the RENTAL table. The procedure should satisfy the following conditions: a. The membership number will be provided as a parameter. b. Use a Count() function to verify that the membership number exists in the MEMBERSHIP table. If it does not exist, then a message should be displayed that the membership does not exist and no data should be...

  • Create the database and tables for the database. Show all SQL statements. Include primary and foreign...

    Create the database and tables for the database. Show all SQL statements. Include primary and foreign keys. Insert data into each table. Show select statements and display the output of each table. Note:Student’s name must be inserted into table as part of the data! Perform the SQL below: Query one table and use WHERE to filter the results. The SELECT clause should have a column list, not an asterisk (*). State the purpose of the query; show the query and...

  • Using the Premier Products database answer the following questions 1. Using a union, display all customers...

    Using the Premier Products database answer the following questions 1. Using a union, display all customers that have rep number 65 or live in the town of Sheldon. Display all customer information. Insert your snip of the query and resultset together here: 2. Using a subquery, list the rep information for all customers who have the same credit limit as customer number 725. To receive credit for this question, do not explicitly query for rep number 35. Let MySQL do...

  • *** C++ *** Create a class called Student that contains a first name ( string) and...

    *** C++ *** Create a class called Student that contains a first name ( string) and an student id number (type long).     1. Include a member function called get_data( ) to get data from the user for insertion into the object,     2. Also include a function called display_data( ) that displays the student data. Then write a complete program that uses the class to do some computation. Your main function, main( ), should create a Dynamic Array of...

  • Please write SQL Query for following questions using Northwind Database: 1. Create a procedure to add...

    Please write SQL Query for following questions using Northwind Database: 1. Create a procedure to add a new record to Territories table. Call it NewTerr. Add the following records using the procedure. TerritoryID        TerritoryDescription     Region 88888 Brooklyn 1 99999 Waco 4 77777 Long Beach 2 2. Create an Update Procedure that will change the Region from 1 to 3 for record with TerritoryID 88888. Call it Update88. 3. Create a Delete Procedure that will delete the one record from...

  • Create an abstract Student class for Parker University. The class contains fields for student ID number,...

    Create an abstract Student class for Parker University. The class contains fields for student ID number, last name, and annual tuition. Include a constructor that requires parameters for the ID number and name. Include get and set methods for each field; the setTuition() method is abstract. Create three Student subclasses named UndergraduateStudent, GraduateStudent, and StudentAtLarge, each with a unique setTuition() method. Tuition for an UndergraduateStudent is $4,000 per semester, tuition for a GraduateStudent is $6,000 per semester, and tuition for...

  • Please solve using c++ plus There are two text files with the following information stored in...

    Please solve using c++ plus There are two text files with the following information stored in them: The instructor.txt file where each line stores the id, name and affiliated department of an instructor separated by a comma The department.txt file where each line stores the name, location and budget of the department separated by a comma You need to write a C++ program that reads these text files and provides user with the following menu: 1. Enter the instructor ID...

  • Create a stored procedure that allows a user to select a bat’s manufacturer and (optionally) serial...

    Create a stored procedure that allows a user to select a bat’s manufacturer and (optionally) serial number using a stored procedure. The output should display all of the players who use the bat’s manufacturer. If the serial number is also provided, only display the players who use that bat’s manufacturer and serial number. Make sure you use a CREATE PROCEDURE call and insert this procedure into the existing database. Submit a document that includes: 1. Commented code for the stored...

  • Look at this partial class definition, and then answer questions a - b below: Class Book...

    Look at this partial class definition, and then answer questions a - b below: Class Book    Private String title    Private String author    Private String publisher    Private Integer copiesSold End Class Write a constructor for this class. The constructor should accept an argument for each of the fields. Write accessor and mutator methods for each field. Look at the following pseudocode class definitions: Class Plant    Public Module message()       Display "I'm a plant."    End Module...

  • I need help for part B and C 1) Create a new project in NetBeans called...

    I need help for part B and C 1) Create a new project in NetBeans called Lab6Inheritance. Add a new Java class to the project called Person. 2) The UML class diagram for Person is as follows: Person - name: String - id: int + Person( String name, int id) + getName(): String + getido: int + display(): void 3) Add fields to Person class. 4) Add the constructor and the getters to person class. 5) Add the display() method,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT