Gokhale Institute of Politics and Economics: B.Sc. (Sem - 01) Database Management System Assignment 02

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Gokhale Institute of Politics and Economics

B.Sc. (Sem – 01)


Database Management System
Assignment 02

Note:

1. Provide your answers only in the Excel sheet provided. No other format will be accepted. The
name of the file should be ‘First Name_Last Name – Registration Number’.
2. All the questions are compulsory.
3. Marks carried by each question are provided inside (). Partially correct answers will not be
considered.
4. Read the pre work instructions carefully before answering the question.

Instruction: Read the article on types of SQL commands here and read the material from slide deck
number 04 before answering question 1 to 4.

1. Match column 1 to 2 and choose the correct option. (2)


1. DCL A. Manage data containers

2. DML B. Retrieve data without changing anything

3. DDL C. Authorize access for the database users

4. DQL D. Modify data in the database objects

1 1-A ; 2-D ; 3-B ; 4-C

2 1-C ; 2-D ; 3-B ; 4-A

3 1-C ; 2-D; 3-A ; 4-B

4 1-B ; 2-A ; 3-D ; 4-C

2. From the following, which statement highlights the key difference between DDL and DML?
(1)
1 DML modify data stored in the database objects and DCL commands are combined
with it. DDL modify the database objects and normally not used by a general user
who accesses data via any application.

2 DML modify data stored in the tables and DDL do not alter any database objects
3 DML modify database objects, combined with DCL. DDL control and manage
the changes made to the database

4 DDL modify data stored in the database objects and DCL commands are combined
with it. DML modify the database objects and normally not used by a general user
who accesses data via any application.

3. Truncate is used to delete the data inside the table while preserving the table structure,
unlike Drop. Is this statement True or False? (1)
1 TRUE

2 FALSE

4. A Database Administrator wants to provide access to a new team member, restrict access
that an old team member had, and then save this change to the database system by
entering the employee number of the team member in the Employee table. In which
sequence would he be using the required commands? (1)
1 Revoke, Grant, Commit

2 Grant, Revoke, Savepoint

3 Grant, Revoke, Commit

4 Grant, Rollback, Commit

Instruction: Watch the video on Joins here and read the material from slide deck number 05 before
answering questions 5 to 8. Note that loading the tables in PGAdmin is not necessary to answer the
questions.

5. Choose the missing parts in the JOIN clause to join the two tables - Orders and People, using
the Region field in both tables as the relationship between the two tables. (1)

Select * from Orders

Left Join _________________ = ________________ ;


1 orders.region = people.region

2 people on orders.region = people.region

3 orders on orders.region =
people.region

4 people.region = orders.region
6. Choose the correct JOIN clause to select all records from the two tables where there is a
match in both tables. (1)

Select * from Orders

_________________ on orders.region = people.region;


1 Inner Join People

2 Left Join People

3 Full Outer Join People

4 Right Join People

7. Choose the correct JOIN clause to select all the records from Table B - People plus all the
matches in Table A - Orders. (1)
Select * From People
2 Left Join orders
______________________ On people.region =
3 Full Join orders
orders.region;
4 Right Join orders
1 Inner Join orders

8. Match the following descriptions with the correct Join type. (2)
1. Result table contains value that has match in both tables. Values A. Left
with no match are dropped entirely.

2. Result table contains all values from left table and B. Right
corresponding matches from Right. Values with no Match are
shown as Null.

3. Result table contains all values from Right table and C. Full Outer
corresponding matches from Left. Values with no Match are
shown as Null.

4. Result table contains all values from BOTH tables. Null values D. Inner
shown if match is not found in corresponding table for either tables.

1 1-C ; 2-B ; 3-A ; 4-D

2 1-D ; 2-B ; 3-A ; 4-C

3 1-C ; 2-B ; 3-D ; 4-A

4 1-D ; 2-A ; 3-B ; 4-C


Instruction: Reference for question 9: Book – Databases – A Beginners Guide, Chapter 6 – Database
Design Using Normalization.

9. Choose all that is applicable from the below mentioned options about Normalization.
Normalization is a database design technique used to – (2)
1 to eliminate anomalies

2 to provide access security

3 to design a logic that creates faster and efficient transaction process

4 to create relationships that link tables with each other

1 1,2,4

2 All of the Above

3 1,3,4

4 None of the Above

Instruction: Read an article here and refer to slide deck number 03 for question 10.

10. For a particular item, there are 30 units in stock. Which of the following property of
database will help to ensure that different users at different location cannot place order for
35 items in total? (1)
1 Consistency

2 Isolation

3 Atomicity

4 Durability

Instruction: Questions 11 to 15 are based on the various queries discussed and practiced in class.
None of the question require you to run them in the application again. Refer the material shared
while learning about queries and the class recordings to answer.

11. Which of the following is not a valid aggregate function? (1)


1 SUM

2 COMPUTE
3 COUNT

4 AVG

12. What will happen when the following query is run? (1)

delete from table1


where first_name is null;
1 When first_name is blank, records are deleted

2 Null values from column first_name are identified and entire such row is deleted

3 In the table called table1, Null values from column first_name are deleted

4 In the table called table1, Null values from column first_name are identified
and entire such row is deleted

13. A Data Analyst is analysing the product types for which discounts are offered in the range of
40% to 60%. She wants to get a list of all such products and arrange them on the basis of the
product type. Which command and operator will she have to use in her query? (1)
1 Having, In

2 Group By, Between

3 Group By, Having

4 Group By, Max, Min

14. Which of the following is the right way to write the Round function in order to get the sum
of revenue up to 3 decimal places? (1)
1 ROUND(sum(revenue)::numeric,2)

2 ROUND(sum(revenue):num,3)

3 ROUND(sum(revenue)::numeric,3)

4 ROUND(sum(revenue)::3)

15. Choose the appropriate description of what is being done with the help of the following
query. (3)
select segment, ROUND(avg(sales)::numeric,2) as avg_sales, round(avg(profit)::numeric,2) as
avg_profit
from orders
group by segment
order by avg(sales) desc;
1 From the Orders table, averaging sales and profit with column headers
avg_sales and avg_profit resepctively, grouping on the basis of the
segment and sorting on average of sales in descending order. The display
will have three columns - segment, avg_sales and avg_profit.

2 From the Orders table, averaging sales and profit rounded up to 2 decimal
places with column headers avg_sales and avg_profit resepctively, sorting
on average of sales in descending order. The display will have three
columns - segment, avg_sales and avg_profit.

3 From the Orders table, averaging sales and profit rounded up to 2


decimal places with column headers avg_sales and avg_profit
resepctively, grouping on the basis of the segment and sorting on
average of sales in descending order. The display will have three columns
- segment, avg_sales and avg_profit.

4 From the Orders table, averaging sales and profit rounded up to 2


decimal places with column headers avg_sales and avg_profit
resepctively, grouping on the basis of the segment and sorting on
average of sales in descending order.

16. Read a short piece on uses of data warehouse in various industries here. Recall the
discussion in class on uses of data warehouse in different industries. Match the following
accordingly. (5)
1. Performance analysis of each product, service, interchange, and exchange rates A. Hospitality

2. Customer profiling and screening B. Manufacturing

3. Identify profitable product lines and required product features C. Service

4. Analyse sales to determine shelf space D. Healthcare

5. Provide feedback to physicians on procedures and tests E. Education

6. Design customized offers and promotions for customers F. Retail

7. Maintain student portals to facilitate student activities G. Finance

8. Predict/spot defaulters and act accordingly H. Government

9. Threat assessment and fraud detection I. Insurance

10. Analyse promotions and memberships to maximize bookings J. Banking

1 1 - J ; 2 - C ; 3 - B ; 4 - F ; 5 - D ; 6 - I ; 7 - E ; 8 - G ; 9 - H ; 10 - A
2 1 - G ; 2 - C ; 3 - B ; 4 - F ; 5 - D ; 6 - I ; 7 - E ; 8 - J ; 9 - H ; 10 - A

3 1 - J ; 2 - C ; 3 - F ; 4 - B ; 5 - D ; 6 - I ; 7 - E ; 8 - G ; 9 - H ; 10 - A

4 1 - J ; 2 - C ; 3 - B ; 4 - F ; 5 - D ; 6 - I ; 7 - E ; 8 - H ; 9 - G ; 10 - A

You might also like