Q. Given the following table:
Table: STUDENT1
No. | Name | Stipend | Stream | Avg Mark | Grade | Class |
---|---|---|---|---|---|---|
1 | Karan | 400.00 | Medical | 78.5 | B | 12B |
2 | Divakar | 450.00 | Commerce | 89.2 | A | 11C |
3 | Divya | 300.00 | Commerce | 68.6 | C | 12C |
4 | Arun | 350.00 | Humanities | 73.1 | B | 12C |
5 | Sabina | 500.00 | Nonmedical | 90.6 | A | 11A |
6 | John | 400.00 | Medical | 75.4 | B | 12B |
7 | Robert | 250.00 | Humanities | 61.4 | C | 11A |
8 | Rubina | 450.00 | Nonmedical | 88.5 | A | 12A |
9 | Vikas | 500.00 | Nonmedical | 92.0 | A | 12A |
10 | Mohan | 300.00 | Commerce | 67.5 | C | 12C |
Give the output of following SQL statement:
(i) SELECT TRUNCATE(AvgMark) FROM Student1 WHERE AvgMark < 75;
(ii) SELECT ROUND(AvgMark) FROM Student1 WHERE Grade = 'B';
(iii) SELECT CONCAT (Name, Stream) FROM Student1 WHERE Class = '12A';
(iv) SELECT RIGHT (Stream, 2) FROM Student1;
Answer =
(i) It will return error because no argument is passed as decimal places to truncate.
(ii)
Output:-
ROUND(AvgMark) |
79 |
73 |
75 |
(iii)
Output:-
CONCAT (Name, Stream) |
RubinaNonmedical |
VikasNonmedical |
(iv)
Output:-
RIGHT (Stream, 2) |
al |
ce |
ce |
es |
al |
al |
es |
al |
al |
ce |
The 3 output is incorrect beacause it is saying where grade=b
ReplyDeleteYou are wrong please check again.
DeleteWill round (78.5) =79 or not?
ReplyDeleteYes. It will 79
Deletewhy (the argument is not passed as decimal place to truncate) ?????
ReplyDeleteBecause in truncate function there must be at least two arguments.
DeleteCan you please clearly explain why in truncate it will give an error?
ReplyDeletethere is no decimal argument how will the system know what to truncate please learn to use truncate first
DeleteSyntax of truncate function TRUNCATE(number, decimals), so it is not complete in question.
DeleteThanks 🙏 it helps me a lot to understand 🙂
ReplyDeleteWelcome : )
Deletewhat does truncate table do? i'm confused
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )