0% found this document useful (0 votes)
44 views

Worksheet 17 Answers

Uploaded by

skhushbir247
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Worksheet 17 Answers

Uploaded by

skhushbir247
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

IP /CS - My SQL Worksheet-17

Question Bank
Answers
https://unacademy.com/@LovejeetArora
Chalo Sath Mil Kar kre Shuru….
1) A table ‘Student’ contains 5 rows and 4 columns initially. 2 more rows are
added and 1 more column is added . What will be the degree and
cardinality of the table student after adding these rows and columns?
i) 7, 5
ii) 5,7
iii) 5,5
iv) None of the above
Ans:- ii) 5,7

2) Insert into student values(1,’ABC’,’10 Hari Nagar’) is a type of which


command :
i) DML
ii) DDL
iii) TCL
iv) DCL
Ans:- i) DML

3) What will be the output of - select mid('Pyhton Programming’,3,9);


i) ton Progr
ii) ton Progr
iii) hton Prog
iv) htonProg
Ans:- iii) hton Prog

4) Write the output of the following SQL statement:


SELECT TRUNCATE(15.79,-1) , TRUNCATE(15.79,0),
TRUNCATE(15.79,1);

a. 15 15 15.7
b. 10 15.7 15.9
c. 10 15 15.7
d. 10 10 15.9

Ans:- a. 10 15 15.7

5) The COUNT( ) in MySQL is an example of :


a. Math function
b. Text function
c. Date Function
d. Aggregate Function
Ans:- d. Aggregate Funcion

6) …….. which of the following sublanguages of SQL is used to query


information from the database and to insert tuples into, delete tuples
from and modify tuples in the database?
a. DML
b. DDL
IP /CS - My SQL Worksheet-17
Question Bank
Answers
https://unacademy.com/@LovejeetArora
Chalo Sath Mil Kar kre Shuru….
c. Query
d. Relational Schema
Ans:- a. DML

7) The ……… clause of SELECT query allows us to select only those rows in
the result that satisfied a specified condition.
a. WHERE
b. FROM
c. HAVING
d. LIKE
Ans:- a. WHERE

8)
Write the output of the following SQL command.
select substr(“COMPUTER”,3,4);

a. MPUT
b. PUTE

c. PU

d. MP
Ans: - a. MPUT

9)
The now() function in MySql is an example of ___________________.
a. Math function
b. Text function
c. Date Function
d. Aggregate Function
Ans :- c. Date Function

10) The _________ command is used to make the changes in a table


permanent.
Ans:- COMMIT

11) Give SQL command that will display the current month from the date
and time.
Ans :- MONTH( )

12) Which of the following keywords will you use in the following query to
display all the records of students whose name start with S?

SELECT * from student where name “S%”


IP /CS - My SQL Worksheet-17
Question Bank
Answers
https://unacademy.com/@LovejeetArora
Chalo Sath Mil Kar kre Shuru….
Ans :- LIKE

13) Which of the following is an aggregate function:

a. Upper()
b. Trim()
c. Date()
d. Sum()

Ans:- d. SUM()

14) Write the output of the following SQL


command:
SELECT left(“Jammu Region”, 5);
a. Region
b. Jammu
c. Jammu Region
d. None of the above.
Ans:- b. Jammu

15)
What will be the output of the following code?

SELECT MOD(14,3);
Ans: 2

16)
What will be the result of the following query based on the table given
here.
IP /CS - My SQL Worksheet-17
Question Bank
Answers
https://unacademy.com/@LovejeetArora
Chalo Sath Mil Kar kre Shuru….
SELECT COUNT(Salary) FROM Instructor;

Ans:- COUNT(Salary)
--------------------
5
17) Write the command to delete all the data of the table ‘activity’ retaining
only structure.
Ans:- DELETE FROM ACTIVITY;

18) Write the output for the following SQL commands


Select round(15.193 , -1);
Ans:- 10

19) Write a SQL query to display date after 20 days of current date on your
system.
Ans:- SELECT CURDATE( ) + 10;

20) Write the output for the following sql command


Select SUBSTR(‘ABCDEFG’, -5 ,3)
Ans:- CDE

21) Which keyword is used to arrange the result of order by clause in


descending order?
a. DSEC
b. DES
c. DESC
d. DESNO
Ans: C. DESC

22) Write the output of the following SQL command.


Select round(14.872,1)
a)14.87
IP /CS - My SQL Worksheet-17
Question Bank
Answers
https://unacademy.com/@LovejeetArora
Chalo Sath Mil Kar kre Shuru….
b)14.9
c)14.8
d) 15
Ans:- b) 14.9

23) The command can be used to change the size of column to the
table.
Ans:- ALTER

24) The command can be used to makes changes in the


rows of a table in SQL.
Ans:- Update

25) Write the output of the following SQL command.

select round (49.88);

a. 49.88

b. 49.8

c. 49.0

d. 50
Ans:- d. 50

26) Write the output of the following SQL command.

select round (19.88,1);

a. 19.88 b. 19.8 c. 19.9 d. 20.0


Ans:- c. 19.9

27) Select count(*) from Employee;


The above query will not consider the following:
a) Numeric value b) Text value c) Null value d) Date
value
Ans:- c) NULL Value

28) Which of the following is/are not correct aggregate functions in SQL:

a. AVG() b) COUNT() c) TOTAL() d) MAX()

Ans:- c) Total( )

29) The command can be used to make changes in the definition of a


IP /CS - My SQL Worksheet-17
Question Bank
Answers
https://unacademy.com/@LovejeetArora
Chalo Sath Mil Kar kre Shuru….
table in SQL.

Ans:- ALTER

30) Write the SQL clause used to sort the records of a table.

Ans:- ORDER BY

31) Write the output of the following SQL command.


select round(15.857,-1);
a. 15.8
b. 15.9
c. 15.0
d. 20
Ans:- 20

You might also like