Question

-- 3. Create a variable to store a numeric grade -- Write a CASE statement that...


-- 3. Create a variable to store a numeric grade
-- Write a CASE statement that uses the variable to calculate a letter grade
-- If the numeric grade is above 100 or below 0, return "Invalid grade"
-- A = 90-100, B = 80-89, C = 70-79, D = 60-69, F = 0-59
-- Hint: SELECT doesn't always require a FROM clause

Homework Answers

Answer #1

Solution:

DECLARE @numericGrade int;

SET @numericGrade= 80;

SELECT

CASE

WHEN @numericGrade >= 90 AND @numericGrade<=100 THEN 'A'

WHEN @numericGrade>= 80 AND @numericGrade<90 THEN 'B'

WHEN @numericGrade>=70AND @numericGrade<80 THEN 'C'

WHEN @numericGrade>=60 AND @numericGrade<70 THEN 'D'

ELSE 'Invalid Grade'
END

Note: Have done it in MSSQL , as no language is asked in specific in the question

Output:

Know the answer?
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
Similar Questions
Write a Java program to display a letter grade based on an actual grade. USING ECLIPSE...
Write a Java program to display a letter grade based on an actual grade. USING ECLIPSE IDE A = 90-100 B = 80-89 C = 70-79 D = 60-69 F = less than 60 The program needs to do the following: 1. Create a short integer to store a grade. (See Week 3 - Things to Know - Java Data Types ) 2. Prompt for a grade ( 0-100). 3. Based on the grade given, use IF statements to display...
C++ Write a program which accepts a numeric test score from the user. It will output...
C++ Write a program which accepts a numeric test score from the user. It will output the letter grade to the user corresponding to the score. Assume no “minus grades” (an A ranges from 90-100, B ranges from 80-89, C ranges from 70-79, D ranges from 60-69 and F is everything else.) Ensure that the score remains in the range of 0 to 100. As an example of the output: Enter your numeric grade and I will tell you your...
Write a program that keeps reading a test score until a -1 is entered. The program...
Write a program that keeps reading a test score until a -1 is entered. The program will output the letter grade according to the table below: Score Grade 90-100.   A 80-89.   B 70-79.   C 60-69.   D < 60.   F For example: Enter a Score (-1 to Exit): 92 The Letter grade for that score is A. Enter a Score (-1 to Exit): -1
Create a Grade application that prompts the user for the percentage earned on a test or...
Create a Grade application that prompts the user for the percentage earned on a test or other graded work and then displays the corresponding letter grade. The application should use the grading scale at your school or the following grading scale: 90 – 100 A 80 – 89 B 70 – 79 C 60 – 69 D below 60 F The application output should look similar to: Enter your marks: 90 Grade: A Notes: coded in java. Please don't make...
Write a function, grade(score), which is given score, and it returns a letter grade — the...
Write a function, grade(score), which is given score, and it returns a letter grade — the grade for that mark — according to this scheme: A: >= 90 B: [80, 90) C: [70, 80) D: [60, 70) F: < 60 The square and round brackets denote closed and open intervals. A closed interval includes the number, and an open interval excludes it. So 79.99999 gets grade C, but 80 gets grade B. Define the main function as follows: In main,...
Create the appropriate frequency distribution graph by hand. Below are the speeds of cars clocked by...
Create the appropriate frequency distribution graph by hand. Below are the speeds of cars clocked by radar on a 35-mph zone of a road on a particular afternoon. 99, 96, 94, 91, 90, 90, 89, 87, 85, 84, 82, 80, 79, 78, 77, 76, 34, 75, 75, 74, 74, 72, 70, 69, 68, 68, 68, 66, 66, 65, 63, 63, 60, 59, 58, 58, 54, 50, 48, 46, 42, 38, 33, 12
Student Grades Student Test Grade 1 76 62 2 84 90 3 79 68 4 88...
Student Grades Student Test Grade 1 76 62 2 84 90 3 79 68 4 88 84 5 76 58 6 66 79 7 75 73 8 94 93 9 66 65 10 92 86 11 80 53 12 87 83 13 86 49 14 63 72 15 92 87 16 75 89 17 69 81 18 92 94 19 79 78 20 60 71 21 68 84 22 71 74 23 61 74 24 68 54 25 76 97...
A mathematics achievement test consisting of 100 questions was given to 50 sixth grade students at...
A mathematics achievement test consisting of 100 questions was given to 50 sixth grade students at maple Elementary School. The following data show the number of questions answered correct by each student. 75 48 46 65 71 49 61 51 57 49 84 85 79 85 83 55 69 88 89 55 61 72 64 67 61 77 51 61 68 54 63 94 54 53 71 84 79 75 65 50 45 65 77 71 63 67 57 63...
In this example you are allowed to use from the C standard library only functions for...
In this example you are allowed to use from the C standard library only functions for input and output (e.g. printf(), scanf()) Complete the following function using C programming language: Complete the function intQ3(floatQ3_input) that takes a student’s average as an input, which is a floating-point value, and returns: 4 if the average is in the range 90-100, 3 if it is in the range 80-89, 2 if it is in the range 70-79, 1 if it is in the...
write a program that automates the process of generating the final student report for DC faculty...
write a program that automates the process of generating the final student report for DC faculty considering the following restrictions. Consider declaring three arrays for processing the student data: studID studName studGrade The student ID is a random number generated by the 5-digit system in the range of (10000 - 99999). Create a function to assign the student ID generated in an array of numbers. Consider the following to generate the random number: Add the libraries: #include <stdlib.h> #include <ctime>...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT