C05B – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Q&A CBSE12D-2015-C05B #5898 siteicon  

Question:

Consider the following DEPT and WORKER tables. Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii) :
Table: DEPT

DCODE DEPARTYMENT CITY
D01 MEDIA DELHI
D02 MARKETING DELHI
D03 INFRASTRUCTURE MUMBAI
D05 FINANCE KOLKATA
D04 HUMAN RESOURCE MUMBAI

Table: WORKER

WNO NAME DOJ DOB GENDER DCODE
1001 George K 2013-09-02 1991-09-01 MALE D01
1002 Ryma Sen 2012-12-11 1990-12-15 FEMALE D02
1003 Mohitesh 2013-02-03 1987-09-04 MALE D05
1007 Anil Jha 2014-01-17 1984-10-19 MALE D04
1004 Manila Sahai 2012-12-09 1986-11-14 FEMALE D01
1005 R SAHAY 2013-11-18 1987-03-31 MALE D02
1006 Jaya Priya 2014-06-09 1985-06-23 FEMALE D05

Note: DOJ refers to date of joining and DOB refers to date of Birth of workers.

(i) To display Wno, Name, Gender from the table WORKER in descending order of Wno.

(ii) To display the Name of all the FEMALE workers from the table WORKER.

(iii) To display the Wno and Name of those workers from the table WORKER w ho are born between ‘1987-01-01’ and ‘1991-12-01’.

(iv) To count and display MALE workers who have joined after ‘1986-01-01’.

(v) SELECT COUNT(*),DCODE FROM WORKER GROUP BY DCODE HAVING COUNT(*)>1;

(vi) SELECT DISTINCT DEPARTMENT FROM DEPT;

(vii) SELECT NAME,DEPARTMENT,CITY
FROM WORKER W,DEPT D
WHERE W.DCODE=D.DCODE AND WNO<1003;

(viii) SELECT MAX(DOJ),MIN(DOB)FROM WORKER;

Answer:

(i) SELECT Wno,Name,Gender FROM Worker ORDER BY Wno DESC;

(ii) SELECT Name FROM Worker WHERE Gender=’FEMALE’;

(iii) SELECT Wno, Name FROM Worker
WHERE DOB BETWEEN ‘1987-01-01’ AND ‘1991-12-01’;
OR
SELECT Wno, Name FROM Worker
WHERE DOB >=’1987-01-01′ AND DOB <=’1991-12-01’;

(iv) SELECT COUNT(*) FROM Worker WHERE GENDER=’MALE’ AND DOJ > ‘1986-01-01’;
OR
SELECT * FROM Worker
WHERE GENDER=’MALE’ AND DOJ > ‘1986-01-01’;

(v)

COUNT(*)       DCODE
2                        D01
2                        D05

(vi)

Department
MEDIA
MARKETING
INFRASTRUCTURE
FINANCE
HUMAN RESOURCE

(vii)

NAME          DEPARTMENT             CITY
George         K MEDIA                        DELHI
Ryma Sen    INFRASTRUCTURE    MUMBAI

(viii)

MAX(DOJ)          MIN(DOB)
2014-06-09        1984-10-19


Share

CSKC| Created: 5-Jan-2019 | Updated: 5-Jan-2019|CBSE12D-2015






×
ssignment Introductory Sessions Beginning to Program Tokens Keyword and Identifiers Data Types Variables and Constants Operators Simple User Input Building Expressions and Formulas Simple Real World Problems Simple If and If Else Multiple-Nested-Ladder of If Else Switch case selection Simple Loops Tricks in Loops - break continue scope Loop Applications - Handling numerals Series printing loops Nested Loops Pattern printing loops Number Varieties and Crunches String Handling (Null Terminated) Strings - string class type Functions (Built-in) Functions - user defined Functions Reference Passing/Returning Arrays Concepts and 1-D Arrays Array Data Management Two dimensional arrays and Matrices Structures Basics Structures passing/returning 2D Array Memory Addressing Display Using IO Manipulation Display Using C Formatting Tricks User Defined Data Types Enumerated Types Preprocessor Directives And Macros Exception Handling Programming Paradigms and OOPs Advantages Abstraction and Encapsulation Polymorphism Inheritance Function Overloading Concepts Function Overloading Varieties Function Overloading Special Cases Defining Classes Creating and Using Class Objects Class Members Accessibility Class Function Types Inline Functions Constant Functions Nesting of Functions Class Members Scope Resolution Static Members in a Class Array of Objects Constructor Concepts Default Constructor Parameterized Constructor Copy Constructor Constructor Overloading Destructors Inheritance Fundamentals Public Derivations Private and Protected Derivations Multiple Inheritance Multi-Level Inheritance Class Nesting Data File Concepts Handling Text Files Handling Binary Files Pointer Concepts Pointer and Arrays Pointers and Functions Object Pointers This Pointer Linked Lists Stacks Queues Introductory Sessions Beginning to Program Tokens Keywords Identifiers Literals Data Types Variables and Constants Operators (Arithmetic-Assignment-Unary-Relational-Logical) Expressions Statements and Formula Based Calculations BlueJ User Input Arguments through main Class Object Creation and Access Wrapper Classes Constructor Basics Constructor Overloading Conversion and Checking Functions Math Functions Function building and calling Function overloading Simple If and If-Else Selection Multiple Conditional Selections Switch Based Selections Basic Loop Types Compound or Nested Loops Jumping within loops Loop Variations Loop Applications - Handling Numerals Specially Named Numbers Series Printing Pattern Printing Scanner Input Buffered Input Array Basics Array Search Array Sorting Other Array Manipulations Two Dimensional Arrays Basics Two Dimensional Arrays Manipulations Character Handling String Basics String Class Functions StringBuffer StringBuilder Types of Errors Exceptions using try-catch Defining Classes Introductory Sessions Beginning to Program Introductory Sessions Beginning to Program Introductory Sessions Beginning to Program Data Types Variables and Constants Introductory Sessions Beginning to Program Python Basics Beginning To Program Tokens, Keywords, Identifiers Variables and Expressions Data Types Operators Building Expressions Collecting User Input elational nary)


Back