Q5 Question Based on SQL & Database Concept Total Marks 8. Theory Question 2 Marks / SQL Commands 6 Marks / Output of commands 2 Marks

Similar documents
SQL-Structured Query Language BY : SHIVENDER KUMAR BHARDWAJ PGT-TAFS

Q1. (SQL) Consider the following table HOSPITAL. Write SQL commands for the statements (i) to (v)

King Fahd University of Petroleum and Minerals

THE INDIAN COMMUNITY SCHOOL, KUWAIT

Please check that this question paper contains 11 printed pages. Please write down the serial number of the question before attempting it.

INFORMATION TECHONOLOGY (402) UNIT 7 DATABASE DEVELOPMENT PRACTICAL QUESTIONS

Real-World Performance Training SQL Introduction

CS2 Current Technologies Lecture 2: SQL Programming Basics

Table : Purchase. Field DataType Size Constraints CustID CHAR 5 Primary key CustName Varchar 30 ItemName Varchar 30 PurchaseDate Date

CS2 Current Technologies Lecture 3: SQL - Joins and Subqueries


CS2 Current Technologies Note 1 CS2Bh

Intro to Structured Query Language Part I

SQL. Char (30) can store ram, ramji007 or 80- b

KENDRIYA VIDYALAYA ALIGANJ SHIFT-II HOLIDAY HOMEWORK CLASS-XII INFORMATICS PRACTICES

Database Management System. * First install Mysql Database or Wamp Server which contains Mysql Databse.

SAMPLE PAPER. Class: XII SUBJECT COMPUTER SCIENCE. Time: 3 Hours MM: 70

Introduction. Introduction to Oracle: SQL and PL/SQL

Objectives. After completing this lesson, you should be able to do the following:

GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement

COMPUTER SCIENCE 1998 (Delhi Board)

Sample Question Paper

CBSE International Class XII Informatics Practices Annual Examination Sample Question Paper

Databases. Relational Model, Algebra and operations. How do we model and manipulate complex data structures inside a computer system? Until


Programming Languages

Part III. Data Modelling. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1

Assignment No. 1 DBMS CONCEPTS

Database implementation Further SQL

KENDRIYA VIDYALAYA SANGATHAN CLASS XII EXAMINATION INFORMATICS PRACTICES (065)

Downloaded from Set :B SECTION A

KENDRIYA VIDYALAYA SANGATHAN, COMPUTER SCIENCE (THEORY) I PRE-BOARD TIME 3 HRS CLASS XII M. Marks 70

ajpatelit.wordpress.com

Downloaded from

1 SQL Structured Query Language

SQL Structured Query Language Introduction

1 SQL Structured Query Language

INFORMATICS PRACTICES (065)

KENDRIYA VIDYALAYA SANGATHAN- ERNAKULAM REGION MODEL PAPER - CLASS XII COMPUTER SCIENCE (083)

Department of Computer Science and Information Systems, College of Business and Technology, Morehead State University

KENDRIYA VIDYALAYA SANGATHAN BLUE PRINT INFORMATICS PRACTICES CLASS XII


(b) Name the header files for the following inbuilt functions. 1 (i) random() (ii) exit() Ans: (i) stdlib.h (ii) process.h/ stdlib.

CHAPTER 10 SQL 6 MARKS QUESTIONS

SYSTEM CODE COURSE NAME DESCRIPTION SEM

Informatics Practices (065) Sample Question Paper 1 Section A

Rani Durgavati Vishwavidyalaya Jabalpur (M.P.) (UICSA) Master of Computer Application (MCA) Practical List of. MCA III SEM Session -2010

INTERNATIONAL INDIAN SCHOOL, RIYADH XI XII BOYS SECTION

Databases - 4. Other relational operations and DDL. How to write RA expressions for dummies

Pivot Tables Motivation (1)

IBM DB2 9 Family Fundamentals. Download Full Version :

SESSION ENDING EXAMINATION CLASS XI SUBJECT : INFORMATICS PRACTICES (065) Time Allowed : 3 Hrs. Max Marks : 70

INTERNATIONAL INDIAN SCHOOL, RIYADH XI XII BOYS SECTION. Subject- Informatics Practices

GREENFIELDS PUBLIC SCHOOL HOLIDAY HOMEWORK- COMPUTER SCIENCE SESSION CLASS - XII STRUCTURED QUERY LANGUAGE

GIFT Department of Computing Science. CS-217: Database Systems. Lab-4 Manual. Reporting Aggregated Data using Group Functions

SESSION ENDING EXAMINATION Set-3 INFORMATICS PRACTICES CLASS XI BLUE PRINT Long Short Very Short

1Z0-007 ineroduction to oracle9l:sql

Database Management Systems,

RESTRICTING AND SORTING DATA

MySQL DML Commands - Joins and subqueries

Intermediate SQL: Aggregated Data, Joins and Set Operators

UNIT - 3 Relational Database Management System

An Introduction to Structured Query Language

An Introduction to Structured Query Language

An Introduction to Structured Query Language

Maharaja Agrasen Model School Sample Paper Subject: Informatics Practices

Q.1 Short Questions Marks 1. New fields can be added to the created table by using command. a) ALTER b) SELECT c) CREATE. D. UPDATE.

Oracle Database SQL Basics

UNIVERSITY OF BOLTON WESTERN INTERNATIONAL COLLEGE FZE BSC (HONS) COMPUTING SEMESTER ONE EXAMINATION 2015/2016 DATABASE THEORY AND PRACTICE

PRE BOARD EXAM Sub:Informatics Practices (065) Class:XII

KENDRIYA VIDYALAYA ONGC PANVELSESSION ENDING EXAM

Question Bank. Class : XII( ) Subject : Informatics Practices(065)

Definitions. Database Architecture. References Fundamentals of Database Systems, Elmasri/Navathe, Chapter 2. HNC Computing - Databases

IBM A Assessment: DB2 9 Fundamentals-Assessment. Download Full Version :

INDIAN SCHOOL MUSCAT FINAL TERM EXAMINATION INFORMATICS PRACTICES

KENDRIYA VIDYALAYA SANGATHAN ERNAKULAM REGION FIRST PRE-BOARD EXAMINATION COMPUTER SCIENCE

Practical Workbook Database Management Systems

Downloaded from

An Introduction to Structured Query Language

An Introduction to Structured Query Language

WHAT IS SQL. Database query language, which can also: Define structure of data Modify data Specify security constraints

Introduc.on to Databases

SQL. Rodrigo García Carmona Universidad San Pablo-CEU Escuela Politécnica Superior

Name :. Roll No. :... Invigilator s Signature : DATABASE MANAGEMENT SYSTEM

Database Foundations. 6-3 Data Definition Language (DDL) Copyright 2015, Oracle and/or its affiliates. All rights reserved.

The Relational Model

Visit for more.

Database: Collection of well organized interrelated data stored together to serve many applications.

Downloaded from

Sankalchand Patel College of Engineering, Visnagar B.E. Semester III (CE/IT) Database Management System Question Bank / Assignment

PRACTICAL ASSIGNMENTS [LAB WORK] CLASS XII IP

Database Systems. Answers

RDBMS Using Oracle. BIT-4 Lecture Week 3. Lecture Overview


KENDRIYA VIDYALAYA SANGATHAN, ERNAKULAM REGION INFORMATICS PRACTICES CLASS XII PRE-BOARD-I

Databases - 5. Problems with the relational model Functions and sub-queries

INDEX. 1 Basic SQL Statements. 2 Restricting and Sorting Data. 3 Single Row Functions. 4 Displaying data from multiple tables

P.G.D.C.M. (Semester I) Examination, : ELEMENTS OF INFORMATION TECHNOLOGY AND OFFICE AUTOMATION (2008 Pattern)

2 SEMESTER EXAM CLASS : 12 DECEMBER 2016 TIME : 3 Hrs MAX MARKS : 70

COSC 304 Introduction to Database Systems SQL. Dr. Ramon Lawrence University of British Columbia Okanagan

Transcription:

Q5 Question Based on SQL & Database Concept Total Marks 8 Theory Question 2 Marks / SQL Commands 6 Marks / Output of commands 2 Marks Q1 Define the Following with example i) Primary Key ii) Foreign Key iii) Candidate Key iv Alternate Key v) Tuple vi Degree vii Cardinality vii) DDL viii) DML Q2. Explain the concept of Cartesian product between two tables, with the help of appropriate example. Q3. What are the two preconditions for Union operation of two relations. Explain the concept with the help of an appropriate example Q4. Q3a)Write SQL queries for and write the outputs for the SQL queries on the basis of the tables Given Below TABLE : EMP EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO 7839 REA MANAGER 67 12-DEC-98 5000 0 10 1234 PREM CLERK 87 11-FEB-77 12000 1500 20 6754 SITA MANAGER 89 12-MAR-99 10000 1000 20 6574 GITA SALESMAN 98 11-JUN-99 9000 0 30 9876 HONEY CLERK 65 12-JUN-00 12000 800 20 8976 REEMA SALESMAN 91 10-SEP-88 6000 100 30 (i) Display names of employees whose names include either of the substring TH or LL. (ii) Display data of all employees sorted by their department, seniority and salary. (iii) Find all the employees who have no manager. (iv) To display all employees who were hired during 1995. (v) Show the average salary for all departments with more than 3 people for a job. (vi) Find out number of employees having MANAGER as job. (vii) Find the output of the following : 1. SELECT SYSDATE FROM DUAL; 2. SELECT ENAME,SAL FROM EMPLOYEE WHERE DEPTNO=20; 3. SELECT COUNT(*) FROM EMP; 4. SELECT AVG(SAL) FROM EMP; C++@12 Question Bank Page 1

2. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii) WORKERS W_ID FIRSTNAME LASTNAME ADDRESS CITY 102 Sam Tones 33 Elm St. Paris 105 Sarah Ackerman 440 U.S. 110 New York 144 Manila Sengupta 24 Friends Street New Delhi 210 George Smith 83 First Street Howard 255 Mary Jones 842 Vine Ave. Losantiville 300 Robert Samuel 9 Fifth Cross Wasington 335 Henry Williams 12Moore Street Boston 403 Ronny Lee 121 Harrison St. New York 451 Pat Thompson 11 Red Road Paris DESIG W_ID SALARY BENEFITS DESIGNATION 102 75000 15000 Manager 105 85000 25000 Director 144 70000 15000 Manager 210 75000 12500 Manager 255 50000 12000 Clerk 300 45000 10000 Clerk 335 40000 10000 Clerk 400 32000 7500 Salesman 451 28000 7500 Salesman (i) To display W_ID, FIRSTNAME, ADDRESS and CITY of all employees living in NEW YORK from the table WORKERS. C++@12 Question Bank Page 2

(ii) (iii) (iv) (v) (vi) (vii) To display the content of workers table in ascending order of LASTNAME. To display the FIRSTNAME, LASTNAME and total salary of all alerks from the tables WORKERS and DESIGN, where total salary is calculated as SALARY + BENEFITS. To display the minimum salary among Managers and Clerks from the table DESIG. SELECT FIRSTNAME, SALARY FROM WORKERS, DESIG WHERE DESIGNATION = Manager AND WORKERS.W_ID = DESIG.W_ID SELECT COUNT(DISTINCT DESIGNATION) FROM DESIG. SELECT DESIGNATION, SUM(SALARY FROM DESIGNATION GROUP BY DESIGNATION HAVING COUNT(*)<3; (viii) SELECT SUM(BENEFITS) FROM WORKERS WHERE DESIGNATION = Salesman ; 3. (a)write SQL commands for (a) to ( j) and write output for (h) on the basis of Teacher relation given below. No Name Age Department Date of Join Salary Sex 1. jigal 34 Computer 10/01/97 12000 M 2. Sharmila 31 History 24/03/98 20000 F 3. Sandeep 32 Maths 12/12/96 30000 M 4. Sangeeta 35 History 01/07/99 40000 F 5. Rakesh 42 Maths 05/09/97 25000 M 6. Shyam 50 History 27/02/97 30000 M 7. Shiv Om 44 Computer 25/02/97 21000 M 8. Shalakha 33 Maths 31/07/97 20000 F (a) To show all information about the teacher of history department. (b) To list the names of female teachers who are in Maths department (c) To list names of all teachers with their date of joining in ascending order. (d) To display students name, fee,age for male teacher only (e) To count the number of teachers with age>23. (f) To insert a new row in the TEACHER table with the following data: 9, Raja,26, Computer,13/05/95,2300, M. (g)to show all information about the teachers in this table (h)add a new column named Address. C++@12 Question Bank Page 3

(i)arrange the whole table in the alphabetical order to name (j)display the age of the teachers whose name starts with S,. (k)give the output of following statement. (i) Select COUNT(distinct department) from TEACHER. (ii) Select MAX(Age)from Teacher where sex= F (iii) Select AVG(Salary) from Teacher where Dateofjoin< 12/07/96 (iv) Select SUM(Salary) from teacher where Dateofjoin< 12/07/96 C++@12 Question Bank Page 4

4. Write SQL commands for the statements (i) to (vi) on the basis of the table EMPLOYEE: Name EmpNo DeptNo Job Sal Comm G. Hussain 2098 10 President 7000 Pallav 3099 30 Manager 9000 1400 Y.D. Sharma 8001 20 Clerk 8500 Bhawna 7901 10 President 4520 300 A. Dasgupta 5400 20 Analyst 6580 P. Arora 3400 10 Clerk 12000 Col. Singhvi 2100 30 Manager 1200 500 Amit 3100 30 Analyst 3250 A D souza 2211 10 Clerk 6900 i. Show sum and average salary for marketing deptt. ii. Check all employees have unique names. iii. Find al employess whose deptt is same as of Amit. iv. Increase the salary of all employees by 10%, v. Find the deptt that is paying max salaries to its employees. vi. Display the details of all the employees having salary less than 10000. 5. Write the SQL commands for (a) to (d) and write the output for (e) on the basis of table Hospital : No Name Age Department Dateofadmin Charge Sex 1 Arpit 62 Surgery 21/01/06 300 M 2 Zayana 18 ENT 12/12/05 250 F 3 Kareem 22 Orthopedic 19/02/06 450 M 4 Abhilash 26 Surgery 24/11/06 300 M 5 Dhanya 24 ENT 20/10/06 350 F 6 Siju 23 Cardiology 10/10/06 800 M 7 Ankita 16 ENT 13/04/06 100 F 8 Divya 15 Cardiology 10/11/06 500 F 9 Nidhin 25 Orthopedic 12/05/06 700 M 10 Hari 28 Surgery 19/03/06 450 M C++@12 Question Bank Page 5

(a) (b) (c) To show all information about the patients of cardiology department. To list the name of female patients who are in ENT department. To list names of all patients with their date of admission in ascending order. (d) To count the no of patients with age > 20. (e) Give the output of the following SQL commands: (i) Select COUNT(DISTINCT charges ) from hospital; (ii) Select MIN(age) from hospital where Sex= M ; (iii) Select SUM(charges) from hospital where Sex = F ; (iv) Select avg(charges) from hospital where dateofadm>{12/05/06}; C++@12 Question Bank Page 6

C++@12 Question Bank Page 7