GTU MCA MATERIAL FOR DBMS II

RSS
  • Home
  • Quick Review
  • Assignment
  • Backup and Recovery
  • Differences
  • About Me

Wednesday, August 3, 2016

SQL Query for Grade Calculations

SQL Query to calculate grade of subjects based on marks.
CREATE TABLE STUDENT(ROLLNO NUMBER(3) PRIMARY KEY,
         NAME VARCHAR2(50),
         C_LANG NUMBER(3) CHECK(C_LANG BETWEEN 0 AND 100),
         JAVA NUMBER(3) CHECK(JAVA BETWEEN 0 AND 100),
         ORACLE NUMBER(3) CHECK(ORACLE BETWEEN 0 AND 100));
INSERT INTO STUDENT
VALUES(101,
       'PARAG SHUKLA',
       56,
       77,
       87);


INSERT INTO STUDENT
VALUES(102,
       'KAPIL SHUKLA',
       87,
       67,
       54);


INSERT INTO STUDENT
VALUES(103,
       'DEVEN PATEL',
       76,
       70,
       68);


INSERT INTO STUDENT
VALUES(104,
       'MUNO',
       48,
       78,
       30);


INSERT INTO STUDENT
VALUES(105,
       'CHAKO',
       45,
       75,
       57);

SELECT ROLLNO,
       CASE
         WHEN C_LANG BETWEEN 85 AND 100 THEN 'AA'
         WHEN C_LANG BETWEEN 75 AND 84 THEN 'AB'
           WHEN C_LANG BETWEEN 65 AND 74 THEN 'BB'
           WHEN C_LANG BETWEEN 55 AND 64 THEN 'BC'
           WHEN C_LANG BETWEEN 50 AND 54 THEN 'CC'
           WHEN C_LANG <50 THEN 'FF'
       END AS C_LANG,
       CASE
         WHEN ORACLE BETWEEN 85 AND 100 THEN 'AA'
           WHEN ORACLE BETWEEN 75 AND 84 THEN 'AB'
           WHEN ORACLE BETWEEN 65 AND 74 THEN 'BB'
           WHEN ORACLE BETWEEN 55 AND 64 THEN 'BC'
           WHEN ORACLE BETWEEN 50 AND 54 THEN 'CC'
           WHEN ORACLE <50 THEN 'FF'
       END AS ORACLE,
       CASE
         WHEN JAVA BETWEEN 85 AND 100 THEN 'AA'
           WHEN JAVA BETWEEN 75 AND 84 THEN 'AB'
           WHEN JAVA BETWEEN 65 AND 74 THEN 'BB'
           WHEN JAVA BETWEEN 55 AND 64 THEN 'BC'
           WHEN JAVA BETWEEN 50 AND 54 THEN 'CC'
           WHEN JAVA <50 THEN 'FF'
       END AS JAVA,
       NAME
FROM STUDENT;

Posted by Dr. Parag Shukla at 9:11:00 AM 0 comments
Email This BlogThis! Share to X Share to Facebook
Labels: Calculate Grade using query, Grade Calculations, Java, Marks, Oracle, SQL Query
Location: India

Saturday, July 30, 2016

Assignment – 7 (Introduction to other Databases)

-->
Atmiya Institute of Technology & Science
Department of M.C.A.
M.C.A. Semester - II
620006 – Databse Management System - II
Assignment – 7 (Introduction to other Databases)
Date : 01 / 06 / 2010
Submission Date : 05 / 06 / 2010
---------------------------------------------------------------------------------------------------------------
Q-1. Explain the Following Questions in detail.

1)
What is Parallel Database System? Explain Advantage, Disadvantage of Parallel Database?
2)
Explain Key element of Parallel Database system?
3)
Explain Architecture of parallel Database with advantage and disadvantage?
4)
Explain inter query parallelism and intra query parallelism?
5)
Explain Advantage, disadvantage of Distributed Database System?
6)
Explain Types and Property of Distributed Databases?
7)
Explain Architecture of Distributed Database System?
8)
Explain Two Phase commit?
9)
Explain features, Advantage and Disadvantage of OODBMS?

Posted by Dr. Parag Shukla at 7:54:00 AM 0 comments
Email This BlogThis! Share to X Share to Facebook
Labels: Distributed Database, OODBMS, Parallel Database

Tuesday, May 3, 2011

Assignment - 7 Query Processing & Optimization


Assignment – 7         Query Processing & optimization    Submission Date 30-05-11  

Q-1. Explain the Following Questions in detail.

1).What do you mean by the term query processing? What are its objectives? 
Draw a neat sketch of high-level query processing?
2).Discuss the reason for converting SQL query into relation algebra queries before query optimization.
3).What is syntax analyzer? Explain with an example.
4).Explain the query decomposer with different phases in detail?
5).What is query optimization? Why it is needed.
6).Describe the query optimization with detail block diagram.
7).Explain how heuristic query optimization is performed with an example.
8).Describe the Transformation rules for query optimizer.
9).What is relational algebra query tree? Explain with example.
10).What is heuristic optimization algorithm? Discuss various steps in heuristic optimization algorithm.
11).Discuss the main components for a cost function that is used to estimate query execution cost.
12).What are the cost components are used most often as the basis for cost function.
13).List the cost function for the SELECT operation.
14).List the cost function for the JOIN operation.
15).What are basic query optimization strategies? List out the different technique.
---------------------------------------------------------------------------------------------------------------
Q-2. Do as Directed

1). Let us consider the fallowing relations (tables) that form part of a database of a relational DBMS

HOTEL     (HOTEL-NO, HOTEL-NAME, CITY)
ROOM      (ROOM-NO, HOTEL-NO, TYPE, PRICE)
BOOKING (HOTEL-NO, GUEST-NO, DATE-FROM, DATE-TO, ROOM-NO)
GUEST      (GUEST-NO, GUEST-NAME, GUEST-ADDRESS)

draw a relational algebra tree for each of the following queries. Use the heuristic rules to transform the queries into a more efficient form.

(A). SELECT R.ROOM-NO, R.TYPE, R.PRICE
       FROM ROOM R, HOTEL H, BOOKING B
       WHERE R.ROOM-NO=B.ROOM-NO AND
       B.HOTEL-NO=H.HOTEL-NO AND
       H.HOTEL-NAME=’EMPERIAL’ AND
       R.PRICE>100

(B). SELECT G.GUEST-NO, G.GUEST-NAME
       FROM GUEST AS G, BOOKING AS B. HOTEL AS H, ROOM AS R
       WHERE H.HOTEL-NO = B.HOTEL-NO AND
       G.GUEST-NO = B.GUEST-NO AND
       H.HOTEL-NO = R.HOTEL-NO AND
       H.HOTEL-NAME = ‘Shiv International’ AND
       B.DATE-FROM >= '1-Jan-05' AND
       B.DATE-TO<='31 Dec-05

2). Write and justify an efficient relational algebra expression that is equivalent to the following given query

SELECT B1.BANK-NAME
FROM BANK1 AS B1, BANK2 AS B2
WHERE B1.ASSESTS>B2.ASSESTS AND
B2.BANK-LOCATION=’Rajkot’

3). Using the above HOTEL schema, determine whether the following queries are semantically correct and justify your answer.
(A). SELECT R.TYPE, R.PRICE
      FROM ROOM AS R, HOTEL AS H
      WHERE R.HOTEL-NUM = H.HOTEL-NUM AND
      H.HOTEL-NAME = 'Taj Residency' AND
      R..TYPE > l00
(B).   SELECT G.GUEST-NO, G.GUEST-NAME
        FROM GUEST AS G, BOOKING AS B, HOTEL AS H
        WHERE R.HOTEL-NO=B.HOTEL-NO AND
        H.HOTEL-NAME=’TAJ’

(C).  SELECT R.ROOM-NO, H.HOTEL-NO
       FROM   ROOM AS R, HOTEL AS H, BOOKING AS B
       WHERE H.HOTEL-NO=B.HOTEL-NO AND
       H.HOTEL-NO=’H40’ AND
       B.ROOM-NO=R.ROOM-NO AND
       R.TYPE>’S’ AND B.HOTEL-NO=’H50’    
Posted by Dr. Parag Shukla at 8:48:00 PM 0 comments
Email This BlogThis! Share to X Share to Facebook

Assignment - 6 Relational Algebra


Assignment – 6 Relational Algebra    Submission Date 12-05-11  


Q.1
Consider the following relations:

Suppliers (Sid, S_name, Address)
Parts (Pid, P_name, Colour)
Catalogue (Sid, Pid, Cost)

The key fields are underlined. Write the following queries in relational algebra.

1) Find the names of suppliers who supply some red parts.
2) Find the Pid of parts supplied by every supplier at less than INR 500.
3) Find the Pid of parts that are supplied by at least two different suppliers.
4) Find the Sid of suppliers who supply every part or green part.
5) Find the Sid of suppliers who supply every part.
6) Find the Sid of suppliers who supply some red or green part.
7) Find the Sid of suppliers who supply some red and some green parts.
Q.2
Consider the relation schemas as follows and Convert Following query into SQL and Relational Algebra.

WORKS           (PERSON_NAME, COMPANY_NAME, SALARY)
LIVES              (PERSON_NAME, STREET, CITY)
LOCATED_IN   (COMPANY_NAME, CITY)
MANAGERS     (PERSON_NAME, MANAGER_NAME)
          Where manager_name referes to Person_name


1)    Find the name of the persons who work for company ‘FBC’
2)    List the names of the persons who work for company ’FBC’ along with the cities they live in.
3)    Find the persons who work for company ’FBC’ with a salary of more than 10000. List the names of these persons along with the streets and cities where they live.
4)    Find the names of the persons who live and  work in the same city.
5)    Find the names of the persons who live in the same city and on the same street as their managers.
6)    Find the names of the persons who do not work for Company ’FBC’.
7)    Find the persons whose salaries are more than the salary of everybody who work for company ’SBC’.
8)    Find the names of the companies that is located in every city where company ’SBC’ is located in.
Q.3
Write down Relational Algebra for the given schema.

SOFTWARE(sid,software_name,develop_in,selling_cost,development_cost)
PROGRAMMER (pid, pname, date_join, dept_name, sid,Salary, gender)


  1. Find out the selling cost average for packages developed in Oracle.
  2. List details of programmer whose salary is greater than Rs.10,000.
  3. Display details of Software develop by “Mr. Ram”.
  4. How many software has highest development cost.
  5. List details of programmer who join in the current month.
  6. Retrieve name of programmer who do not involve in any software development.
  7. Retrieve all male programmers working in ‘MCA’ department.

Posted by Dr. Parag Shukla at 8:40:00 PM 0 comments
Email This BlogThis! Share to X Share to Facebook
Newer Posts Older Posts Home
Subscribe to: Comments (Atom)

Total Pageviews

Blog Archive

  • ▼  2019 (1)
    • ▼  March (1)
      • Privacy Policy
  • ►  2016 (7)
    • ►  August (6)
    • ►  July (1)
  • ►  2011 (16)
    • ►  May (2)
    • ►  April (6)
    • ►  March (5)
    • ►  February (3)
  • ►  2010 (9)
    • ►  May (4)
    • ►  March (5)
  • ►  2009 (1)
    • ►  December (1)

Followers

Blog List

Search

Parag Shukla. Powered by Blogger.

Popular Posts

  • Serial Schedule Vs Non-Serial Schedule
    Serial Schedule Non-Serial Schedule A serial schedule is a sequence of operat...
  • Dirty Read Vs Unrepeatable Read
    Dirty Read Unrepeatable Read A dirty read problem occurs when one transaction updates a ...
  • Log Based Recovery
    Log Based Recovery The most widely used structure for recording database modification is the log. The log is a sequence of log ...
  • Lost Update Vs Uncommitted Data
    Lost Update Uncommitted Data This problem is also known as “Multiple Update...
  • Shadow Paging
    Shadow Paging This technique does not require LOG in single user environment In mult...
  • Starvation Vs Deadlock
    Starvation Deadlock Starvation happens if same transaction is always choosen ...
  • Checkpoints
    Checkpoints When System failure occurs o We must consult log to determine those transaction that need to be redone and those tra...
  • Defferred Update method
    Deferred update Do not physically update the database on disk until after a transaction reaches its commit point; Then updates are r...
  • Assignment - 7 Query Processing & Optimization
    Assignment – 7         Query Processing & optimization    Submission Date 30-05-11   Q-1. Explain th...
  • Immediate Update Method
    Immediate update technique Database may be updated by some operations of a transaction before the transaction reaches its commit poi...
Copyright © 2010 GTU MCA MATERIAL FOR DBMS II