12_ip_mysql
12_ip_mysql
LEVEL-1
I. MCQ
1. The avg) function in MySql is an example of ___________.
(a) Math Function
(b) Text Function
(c) Data Function
(d) Aggregate Function
2. The month() function in MySql is an example of_____.
(a) Math Function
(b) Text Function
(c) Aggregate Function
(d) Date Function
3. A ________ is a collection of logically related data.
(a) Table
(b) Row
(c) Column
(d) Database
4. 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
5. _________ is the format of date in MySQL.
(a) yyyy-mm-dd
(b) mm-dd-yyyy
(c) dd-yyyy-mm
(d) d-m-year
6. Varchar is a fixed length datatype. (True/False)
7. Which sql function is used to find the highest value in the field.
(a) Min()
(b) Max()
(c) Highest()
(d) Big()
8. Write the command to delete the table employee.
(a) Delete Employee;
(b) Delete table Employee;
(c) Drop table Employee;
(d) Drop Employee table;
9. Which of the following aggregate operation adds up all the values of the attribute?
(a) Add
(b) Avg()
(c) Max()
(d) Sum()
10. What will be the output of the query SELECT LCASE(‘wELCome’);
(a) WELCOME
(b) WelcOME
(c) Welcome
(d) welcome
II. Section- B
1. Write the appropriate datatypes for the following fields.
(i) Dateofbirth
(ii) Salary
(iii) Name
(iv) Address
1
(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.
III. 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:
2
order of SDate.
V. 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
4
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:
3. Write the SQL functions which will perform the following operations:
5
iv) To display your name in upper case.
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.
6
iv. Display the highest salary of salesman having name length more than 15 and who gets
bonus.
*********