Databases | SQL | Oracle | MS Access Answers

Questions: 901

Answers by our Experts: 732

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Q.4. Answer the following as SQL queries. Also write corresponding relational algebra expression:                                              (15 marks)

    a. Number of rakats prayed as Qaza by each person

    b. How many females have skipped fajar salah on 1st shawwal

    c. How many salah are missed by Mr. Noman

    d. Average time M. Noman takes for praying Isha Salah

    e. Which salah is missed mostly by M. Saleem

    f. Which salah is missed the second most by all people



Pizza(pizza)

Customers (cname,area)

Restaurants (rname,area)

Contains (pizza,ingredient)

Sells(rname,pizza,price)

Likes(cname,pizza)


Primary keys are bolded

Foreign keys are:

• Contains.pizza is a foreign key that refers to Pizzas.pizza.

• Sells.rname is a foreign key that refers to Restaurants.rname.

• Sells.pizza is a foreign key that refers to Pizzas.pizza.

• Likes.cname is a foreign key that refers to Customers.cname.

• Likes.pizza is a foreign key that refers to Pizzas.pizza.


Answer in Relational Algebra Format


Find all customer-pizza pairs (C, P) where the pizza P is sold by some restaurant

that is located in the same area as that of the customer C. Include customers

whose associated set of pizzas is empty.


Consider the relation schema R=(A, B, C, D) with functional dependency F as follows

A BC

B D

D B


Show a decomposition of R into R1 and R2 so that each relation of the decomposition is

in BCNF and also dependency preservation is achieved.


1.  Which of the following is true about graph?


a. A graph may contain many edges and no vertices

b. A graph may contain no vertices and many edges

c. A graph may contain no edges and many vertices

d. A graph may contain no edges and no vertices


1.  Which of the following options is an instance of divide and conquer


a. merge sort

b. Bubble sort

c. selection sort

d. insertion sort


1.  Given a directed graph G with the set of edges E = { (1, 2), (2, 4), (4, 2) (4, 1)} what will be the set of edge of it transpose?


a. E = { (4, 1), (4, 2) (2, 4), (1, 2)}

b. E = { (1, 2), (2, 4), (4, 2) (4, 1)}

c. None of the options

d. E = { (2, 1), (4,2), (2, 4) (1,4)}



1.  An array contains five numbers 12,5,7,-1,2 to be sorted. If after the first iteration, the array is now 5,7,-1, 2, 12. Which algorithm is being used?


a. insertion sort

b. merge sort

c. selection sort

d. Bubble sort



1. An array A[0..n-1] is sorted using the Insertion sort algorithm. The worst case and the best case running time of this computation respectively are


a. O (n log n) and O (n)

b. O (n2) and O (n)

c. O (n log n) and O (n log n)

d. O (n) and O (n log n)


1. An array A[0..n-1] is sorted using the merge-sort algorithm. The worst case and the best case running time of this computation respectively are


a. O (n) and O (n log n)

b. O (n log n) and O (n)

c. O (n log n) and O (n log n)

d. O (n2) and O (n log n)



1. Consider the problem of searching an element x in an array of size n. which class of algorithm can we use If we want to solve the problem in O(Logn)


a. Divide and Conquer

b. Best first search algorithm

c. Greedy algorithm

d. Dynamic Programming


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS