PALLAVI MODEL SCHOOL
BOWENPALLY
INFORMATICS PRACTICES (065)
CASE STUDY BASED QUESTIONS &QUERIES
Instructions:
1. Understand the assignment. Write the outputs in your class work .
2. Holiday Homework should be submitted on the first day of the school after vacation(online/offline).
3. Neat and clean presentation with own handwriting.
Note: Do practice all the queries in the given worksheet
1. A School in Delhi uses database management system to store student details. The school
maintains a database 'school_record' under which there are two tables.
Student Table : Maintains general details about every student enrolled in school.
StuLibrary Table : To store details of issued books. BookID is the unique identification number
issued to each book. Minimum issue duration of a book is one Day.
i. Identify the SQL Query which displays the data of StuLibrary table in ascending order of
StudentID.
i) Select * from StuLibrary Order By BookID
ii) Select * from StuLibrary Order By StuID
iii) Select * from StuLibrary Order By StuID ASC
iv) Select * from StuLibrary Order By StuID DESC
Choose the correct option:
a. Both Query i) and iv) will display the desired data.
b. Both Query i) and ii) will display the desired data.
c. Both Query iii) and iv) will display the desired data.
d. Both Query ii) and iii) will display the desired data.
ii. The Primary Key for StuLibrary Table is/are …….
a. BookID
b. BookID,StuID
c. BookID,Issue
d_date d.Issued_date
iii. Which of the following SQL Query will fetch ID of those issued books which have not been
returned?
a. SELECT BookID from StuLibrary where BookID is NULL;
b. SELECT BookID from StuLibrary where StuID is NULL;
c. SELECT BookID from StuLibrary where Issued_date is NULL;
d. SELECT BookID from StuLibrary where Return_date is NULL;
iv. The Alternate Key for Student Table will be ……….
a. StuName
b. StuContact
c. StuAadhar
d. StuClass
v. Which of the following SQL Query will display dates on which number of issued books is
greater than 5?
a. SELECT Issued_date from StuLibrary GROUP BY Issued_date where COUNT(*)>5;
b. SELECT Issued_date from StuLibrary GROUP BY Return_date having count(*)>5
c. SELECT Issued_date from StuLibrary GROUP BY Issued_date having count(*)>5
d. SELECT Issued_date from StuLibrary GROUP BY Return_date where COUNT(*)>5
2. A Departmental store ‘Iconic’ is planning to automate its system so that they can store all the
records on computer. They contacted a Software Company to make the software for the same.
The company suggested that there is need of a front end and back-end software. The major
challenge was to keep the record of all the items available in the store. To overcome the problem,
the software company has shown the glimpses of the database and table required to resolve their
problem:
Database Name: Iconic
Table Name: Garment
Attributes of the table: Gcode – Numeric, Gname – Character 25, Size - Character 5, Colour –
Character 10, Price – Numeric
Consider the following records in ‘Garment’ table and answer the given questions:
i. Choose the command that will give the output as:
a. Select left(COLOUR,3) from GARMENT where COLOUR like “B%”;
b. Select COLOUR from GARMENT where COLOUR not like “%B%”;
c. Select mid(COLOUR,3) from GARMENT where COLOUR like “B%”;
d. Select COLOUR from GARMENT where COLOUR = ‘B%’;
ii. Choose the correct command for the following purpose.
To delete the record with GCode as 116
a. Delete * from GARMENT where GCode=’116’;
b. Delete from GARMENTS where GCode =116;
c. Delete from GARMENT where GCode =116;
d. Delete from GARMENT where GCode is ’116’;
iii. Give the output of :
Select GName, Price from GARMENT order by Price Desc;
iv. Choose the correct command for the following purpose. To change the colour of GARMENT
with code as 116 to “Orange”.
a. Update GARMENTS set COLOUR=”Orange” where Gcode=116;
b. Update GARMENT set COLOUR =”Orange” where Gcode=116;
c. Update GARMENT set COLOUR =”Orange” where Gcode is ”116”;
d. Update GARMENT where Gcode=116 set COLOUR =Orange;
v. What is the degree and cardinality of ‘GARMENT’ table?
a. Degree=5 & Cardinality=6
b. Degree=6 & Cardinality=5
c. Degree=5 & Cardinality=7
d. Degree=7 & Cardinality=5
vi. Suggest a free software for managing the database
a. Oracle
b. MySQL
c. Sybase
d. Microsoft SQL Server
3. A Fashion Store MyStore is considering to maintain database of their Customers in SQL to
store the data, As a Database Administrator Hina has decided that
Name of the database: MyStore
Name of the table: Customer
Attributes of the tables: Acc_No – Numeric, Cust_Name – Character 25, Cust_City - Character
25, Cust_Phone - Character 11, Open_Bal – Numeric
Consider the following records in ‘Customer’ table and answer the given questions:
i. With reference to the above given table, give query for generating following output
a. Select Name from Customer where Open_bal<20000;
b. Select Name from Customer where Cust_City like ‘%a’;
c. Select Cust_Name from Customer where Cust_City like ‘%a’;
d. Select Cust_name from Customer where Cust_Name like “a%;
ii. Give the output of : Select Cust_Name, Open_Bal from Customer order by Open_bal;
iii. Pranay has given the following command to obtain Highest Opening Balance of each City
Select max(Open_Bal) from Customer where group by Cust_City; but he is not getting the
desired result. Help him by writing the correct command.
a. Select Max(Open_Bal) group by Cust_City;
b. Select Max(Open_Bal) from Customer where group by Cust_City;
c. Select Cust_City, Max(Open_Bal) from Customer group by Cust_City;
d. Select max(Open_Bal) from Customer group by Cust_name;
iv. Help Pranay find the total no. of records having open_bal between 15000 to 20000 by
selecting the right command:
a. Select total from customer having open_bal between 15000 and 20000;;
b. Select count(*) from customer where open_bal between 15000 to 20000;;
c. Select count(*) from customer where open_bal between 15000 and 20000;
d. Select count(*) from customer order by open_bal;
v. Choose the correct command to display the first two letters of each customer’s name.
a. select right(cust_name,2) from customer;
b. select left(cust_name,2) from customer;
c. select right(cust_name,0,2) from customer;
d. select left(cust_name,2) from customer;
4. A Gift Gallery has different stores in India. Database Administrator Abhay wants to maintain
database of their Salesmen in SQL to store the data, He has decided that
Name of the database: GiftGallery
Name of the table: Salesman
Attributes of the tables: Scode – Numeric, Sname – Character 25, Address - Character 25,
Dojoin - Date, Sales – Numeric and Area – Character 10
Consider the following records in ‘Salesman’ table and answer the given questions:
ii . Which of the following commands will display the details of all sales record of North Area,
regardless of case (whether North / NORTH / north):
a. Select * from salesman where area like upper ‘north’;
b. Select * from salesman where area = ‘North’ or ‘NORTH’ or north;
c. Select * from salesman where upper(area)=’NORTH’;
d. Select * from salesman where area= =upper(’North”)’;
iii. Help Priya to display sname and sales of east and west areas
a. Select sname, sales from Salesman where area=”East” and area=”West”;
b. Select sname, sales from Salesman where area=”East” or area=”West”;
c. Select sname, sales from Salesman where area in ”East” and ”West”;
d. Select sname, sales from Salesman where area=”East” , ”West”;
iv. The command to display the name of the salesman along with the sales amount rounded off to
one decimal point will be:
a. Select sname, round(sales,1) from salesman;
b. Select sname, round(sales,0.1) from salesman;
c. Select sname, trunc(sales,1) from salesman;
d. Select sname, trunc(sales,0.1) from salesman;
5. QUERIES:
TABLE :EMP
1.. Display the details of all employees.
2. Display the department information from department table.
3. Display the name and job for all the employees .
4. Display the name and salary for all the employees .
5. Display the employee no and totalsalary for all the employees .
6. Display the employee name and annual salary for all employees.
7. Display the names of all the employees who are working in department number 10.
8. Display the names of all the employees who are working as clerks and drawing a salary more
than 3000.
9. Display the employee number and name who are earning comm.
10. Display the employee number and name who do not earn any comm.
11. Display the names of employees who are working as clerks,salesman or analyst and
drawing a salary more than 3000.
12. Display the names of the employees who are working in the company for the past 5 years;
13. Display the list of employees who have joined the company before 30-JUN-90 or after 31-
DEC-90.
14. Display current Date.
15. Display the names of all tables from current user;
16. Display the name of the current user.
17. Display the names of employees working in depart number 10 or 20 or 40 or employees
working as CLERKS,SALESMAN or ANALYST.
18. Display the names of employees whose name starts with alphabet S.
19. Display the Employee names for employees whose name ends with alphabet S.
20. Display the names of employees whose names have second alphabet A in their names.
_____________________________x______________________________________