Home > database >  Using variable query "result" score less than 80 in the table, and course student id numbe
Using variable query "result" score less than 80 in the table, and course student id numbe

Time:09-15

Declare two variables and then using the SET and SELECT for the declared variable assignment, the query to use these two variables in the table "result" score less than 80, and the course number is "0102002" book student student id,
The Result table: Cno, Sno, Result, Semester

CodePudding user response:

What do you mean by field doesn't indicate, so it is good to write variables about
 Declare @ Score a decimal (19, 2) - Score 
Declare @ ClassNo varchar (50), course number
The SET @ Score=80
The SET @ ClassNo='0102002'

- query (the fields in the table you and actual replacement)
SELECT * FROM Result
WHERE Score<@ Score AND ClassNo=@ ClassNo

  • Related