complex-mysql
complex-mysql
LEVEL-2
I. MCQ
1. Duplication of record is called ___________.
(a) Duplicate
(b) Redundancy
(c) Integrity
(d) Aggregate
2. The month() function in MySql ia an example of_____.
(a) Math Function
(b) Text Function
(c ) Data Function
(c) Aggregate Function
3. Find the output for the following query
SELECT RIGHT(‘SOFTWARE’,2);
(a) RE
(b) WA
(c) OFTWARE
(d) O
4. SELECT ROUND(79.987,2)
(a) 79
(b) 80
(c) 79.99
(d) 79.9
5. SELECT MOD(20,3);
(a) 1
(b) 2
(c) 3
(d) 4
6. SELECT INSTR(‘INFORMATION FORM’,’FOR’);
(a) 3
(b) 12
(c) 13
(d) 2
7. The command ______ can be used to make changes in the rows of a table in SQL.
(a) Alter
(b) Update
(c) Delete
(d) Change
8. Which command can be used to arrange data in some order in a table in SQL.
(a) Group by
(b) Sort
(c) Arrange by
(d) Order by
9. If you want to exclude duplicate values from the aggregate function results, use the _______
keyword.
(a) Primary key
(b) Unique
(c) DISTINCT
(d) COMMON
10. The string function that returns the index of the first occurrence of substring
is______________.
(a) INSERT()
(b) INSTR()
(c) INSRING()
(d) SUBSTR()
II. SECTION-B
i. NOT NULL
ii. UNIQUE
iii. DEFAULT
iv. PRIMARY KEY
v. FOREIGN KEY
5. Define Primary Key of a relation in SQL. Give an Example using a dummy table.
8. Write any two differences between Single_row functions and Aggregate functions.
III. SECTION- C
1. Write SQL queries for the following :
Table : STIPEND
a. Display the names of those students who has Position ‘P1’ sorted by NAME.
b. Display Name, Subject and Amount received in a year (as Annual Amount) assuming that
monthly amount is given in table.
2. Write outputs for SQL queries which are based on the given table GARMENT:
TABLE: SALES
Write SQL queries using SQL functions to perform the following operations:
ii. Display the year name for the date of join of salesman.
iii. Display the name of the weekday for the date of join of salesman whose month is 12.
iv. Display the highest salary of salesman having name length more than 15 and who gets bonus.
*********