SQL Programming Report three values found in the PAYINFO table and store them in
ID: 3725774 • Letter: S
Question
SQL Programming
Report three values found in the PAYINFO table and store them in variables. Output should be:
Values are 15, 18.5, 40
DROP TABLE EMPLOYEE CASCADE CONSTRAINTS; CREATE TABLE EMPLOYEE ID Name Hours CHARL9) VARCHAR2 (12) NUMBER3) CONSTRAINT PK EMPLOYEE PRIMARY KEY (ID) INSERT INTO EMPLOYEE VALUES (717222144','Daleaz', 30) INSERT INTO EMPLOYEE VALUES'013331902',Jones',50) INSERT INTO EMPLOYEE VALUES'591342771', 'Nesmith',65) INSERT INTO EMPLOYEE VALUES 822182889'", 'Tark', 25) SELECTFROM EMPLOYEE: DROP TABLE PAYINFO CREATE TABLE PAYINEO Regular NUMBER 4, 2), overtime BR 4,2, Cutoff NUMBER12) INSERT INTO PAYINFO VALUES (15.00, 18.50, 40) SELECTFROM PAYINFO: CoMMITExplanation / Answer
Declare @value1 int = 15, @value2 int = 18.5, @value3 int = 40
SELECT ' Values are ' + CAST(@value1 AS VARCHAR) + ', ' + CAST(@value2 AS VARCHAR) +', ' +CAST(@value3 AS VARCHAR)
Expected output : Values are 15,18.5,40
We're using CAST here because we need to convert the numeric values to String. Similarly, CONVERT can also be used.
For ex: convert(varchar,@Number) // @Number is the numeric value you want to print.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.