Home > database >  Written in the MYSQL database statements below
Written in the MYSQL database statements below

Time:10-02





Write a program to complete the following functions, the executor in the query analyzer, and record the results,
1. The score table for a certain class course information and the lowest points of students, including student id, name, course name, grade four fields,
2. Information query in a class of students, the field is required to list: class, our class the student id, name, gender, birth date, the political landscape
3. To insert three new records in the student table, the Pollity field is NULL, the value of the requirement for record query, corresponding to the NULL values in the display is shown as "the masses"
4. According to the score table test scores, average query a certain class course, and according to the average output the corresponding message
5. According to the score table test scores, query the examination of the students in a class, and use CASE will be replaced with the curriculum course's name
6. According to t_score examination results in the table, query the examination of the students in a class situation, output test on the test scores and grades,

Stored procedures to create and call
Complete the following functions by the requirement, and record the results,
1. Create a stored procedure stuscoreinfo, complete in the table is the function of student, course and score table query in the following fields: class, student id, name, gender, course name, test scores,
2. Create a stored procedure with parameters stu_info, the stored procedure according to the incoming student no., query the student in the student information,
3. With parameters to create a stored procedure stu_age, the stored procedure according to the incoming students number, calculate the students in the student's age, and returns a different value according to the results of the program, the program execution is successful, returns the integer 0, if wrong, it returns error number,
4. Perform stuscoreinfo stored procedure (no arguments)
5. Execute the stored procedure stu_info (the stored procedure is an input parameter "student id", when executed need to pass in a student id value),
6. Execute the stored procedure stu_age (the stored procedure has a "student id" input parameters and one output parameter @ the age, after the stored procedure execution should be a return to the state of the value, this value can be got from the returned error number),
7. Using the system stored procedure sp_help sp_helptext, sp_depends, sp_stored_procedures view the user to create a stored procedure
8. To delete a stored procedure stuscoreinfo

The creation of a custom function and call
Complete the following functions as required, the executor in the query analyzer, and record the results,
1. Use a custom function fun_sumscores, scored an average score of each class's and grade's all courses in the table, the main program calls the function, according to each class, the average score of each course,
2. Write a user-defined functions fun_sumscores, class and course requirements based on the input, obtained the class with the score of this course, the main program calls the function, of the specified class with the score of a certain course,
3. Write a custom function that is used to query the students of a given name, if not found, returns 0, or return to satisfy the condition number of the students, the main program calls the function, the query "li" of students, and according to the function return value of output,
Thinking and practice
To the library database of JS, TS, CBS, JY table to operate:
Query the borrower borrowing (if repeated borrowing a book, in a book), demanding: library card number, name, borrow books,

CodePudding user response:

Recently on individual public & lt; Andyqian> Updated some columns on the MySQL articles, some of them when it comes to this part of content, suggest you look at, there should be help to you!
  • Related