standard-mysql
standard-mysql
LEVEL-1
I. MCQ
1. To specify condition with a GROUP BY clause _______clause is used.
(a) USE
(b) WHERE
(c) HAVING
(d) LIKE
2. What values does the count() function ignore?
(a) Repetitive values
(b) Null values
(c ) Characters
(c) Integers
3. Which clause is similar to “Having” clause in Mysql?
(a) SELECT
(b) WHERE
(c) FROM
(d) None of the above
4. Nested grouping can be done by providing __________ in the Group By expression.
(a) SINGLE ROW
(b) MULTIPLE FIELDS
(c) SINGLE COLUMN
(d) MULTIPLE TABLES
5. Predict the output of the query SELECT INSTR(‘[email protected],’.’);
(a) 12
(b) 14
(c) 11
(d) 10
6. Data type of “name” field in a table is char(25). How many bytes will be occupied by values
“Ram” and “Rohan kumar”?
(a) 20
(b) 13
(c) 25
(d) 14
7. Write the output of the following SQL command: SELECT ROUND(458.45,-1);
(a) 450
(b) 460
(c) 458
(d) 500
8. SELECT SUBSTR(“COMPUTER”3,4);
(a) MPUT
(b) PUTE
(c) PU
(d) MP
9. SELECT ROUND(124.44)+MOD(1200.87,3);
(a) 124.87
(b) 1325.31
(c) 1324
(d) 125.98
10. Which command is used to add column in a table?
(a) Addition
(b) Alter
(c) Modify
(d) Select
II. SECTION-B
Consider the following table Timetable.
Write SQL commands for the following statements.(C_teacher = Class Teacher)
Table : Timetable
m) Display the detail of Class VIII teacher whose workload is more than 20;
n) Display Name, Class and Workload of teacher whose workload is between 20 and 30 (including
both )
III. SECTION-C
Consider the following tables Sender and Receiver. Write SQL commands for the statements (a) to (d)
and give the outputs for SQL queries (e) to (h).
Table: Sender
b) To display the Receiver id, Sender Name, Sender Address , Receiver City, Receiver Address for
every Receiver.
c) To display Sender details in descending order of Sender City.
f) SELECT S.SName, R.RName, S.S_Add From Sender S, Recipient R Where S.S_id = R.S_id AND
R.R_City =’Mumbai’;
g) Select R_id, R_Add from Receiver Where R_City NOT IN (‘Mumbai’, ‘New Delhi’) ;
***********
MySQL WORKSHEET
LEVEL-1
IV. MCQ
11. The avg) function in MySql is an example of ___________.
(e) Math Function
(f) Text Function
(g) Data Function
(h) Aggregate Function
12. The month() function in MySql is an example of_____.
(d) Math Function
(e) Text Function
(f) Aggregate Function
(g) Date Function
13. A ________ is a collection of logically related data.
(a) Table
(b) Row
(c) Column
(d) Database
14. Which field you choose as primary key out of following in “Employee” table.
(a) Emp_id
(b) Emp_name
(c) Emp_salary
(d) Emp_desig
15. _________ is the format of date in MySQL.
(a) yyyy-mm-dd
(b) mm-dd-yyyy
(c) dd-yyyy-mm
(d) d-m-year
16. Varchar is a fixed length datatype. (True/False)
17. Which sql function is used to find the highest value in the field.
(a) Min()
(b) Max()
(c) Highest()
(d) Big()
18. Write the command to delete the table employee.
(a) Delete Employee;
(b) Delete table Employee;
(c) Drop table Employee;
(d) Drop Employee table;
19. Which of the following aggregate operation adds up all the values of the attribute?
(a) Add
(b) Avg()
(c) Max()
(d) Sum()
20. What will be the output of the query SELECT LCASE(‘wELCome’);
(a) WELCOME
(b) WelcOME
(c) Welcome
(d) welcome
V. Section- B
1. Write the appropriate datatypes for the following fields.
(i) Dateofbirth
(ii) Salary
(iii) Name
(iv) Address
(v) Phonenumber
2. Name two types of SQL Commands.
3. Identify the DDL and DML commands from the following.
Create, Alter, Insert, Update, Drop, Delete, Select
4. Mysql is an _____________software. (open source/Proprietary)
5. Write any two advantages of database.
6. What is meant by cardinality and degree.
7. Answer the following questions on the basis of the given table.
VI. SECTION-C
1. Write SQL commands to create table STUDENT, which the fields of
ROLLNO,NAME,CLASS,AGE with the specific datatypes.
2. Insert 2 set of values in the above table STUDENT.
3. Give the output for the following queries based on the table GARMENT:
order of SDate.