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

12 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. The 3 output is incorrect beacause it is saying where grade=b

    ReplyDelete
  2. Will round (78.5) =79 or not?

    ReplyDelete
  3. why (the argument is not passed as decimal place to truncate) ?????

    ReplyDelete
    Replies
    1. Because in truncate function there must be at least two arguments.

      Delete
  4. Can you please clearly explain why in truncate it will give an error?

    ReplyDelete
    Replies
    1. there is no decimal argument how will the system know what to truncate please learn to use truncate first

      Delete
    2. Syntax of truncate function TRUNCATE(number, decimals), so it is not complete in question.

      Delete
  5. Thanks 🙏 it helps me a lot to understand 🙂

    ReplyDelete
  6. what does truncate table do? i'm confused

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post