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 DEPARTMENT 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 D03
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 who 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 ’;

(v) COUNT(*) DCODE

2

2

D01

D05

(vi) Department

MEDIA

MARKETING

Infrastructure

Finance

Human Resource

(vii) Name Department City

George K

Ryma Sen

Media

Infrastructure

Delhi

Mumbai

(viii) Max(doj) Min(dob)
2014-06-09 1984-10-19

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free

Similar questions

Write a python program using function to accept a list as parameter and multiply all the odd elements by 5. [This program will also demonstrate by reference concept]
Write a program that accepts a sentence and calculate the number of upper case letters and lower case letters.
Suppose the following input is supplied to the program:
Python Programming SKILLS
Then, the output should be:
UPPER CASE 8
LOWER CASE 15
Write the Pseudocode to sort the list using Insertion sort – to sort a list A in ascending order
Given a list of numbers (integers), write a function to return the second maximum and second minimum in this list.

Write a menu driven python program using function to do the following: 1. Reverse a Number, 2. Check whether a number is Palindrome or not and 3. To check whether it is Armstrong or not and 4 to exit. Program should continue till the user says 'no'
Write a python program using function to accept a list as parameter and print all the even number in the list.
Write AddClient(Client) and DeleteClient(Client) methods in python to add a new Client and delete a Client from a List of Client Names, considering them to act as insert and delete operations of the queue data structure.
Xcelencia Edu Services Ltd. is an educational organization. It is planning to set up its India campus at Hyderabad with its head office at Delhi. The Hyderabad campus has four main buildings - ADMIN, SCIENCE, BUSINESS and MEDIA.

You as a network expert have to suggest the best network related solutions for their problems raised in (a) to (d), keeping in mind the distances between the buildings and other given parameters.

Shortest Distances between various buildings:

ADMIN to SCIENCE 65 M
ADMIN to BUSINESS 100 m
ADMIN to ARTS 60 M
SCIENCE to BUSINESS 75 M
SCIENCE to ARTS 60 M
BUSINESS to ARTS 50 M
DELHI Head Office to HYDERABAD Campus 1600 KM

Number of Computers installed at various building are as follows:

ADMIN 100
SCIENCE 85
BUSINESS 40
ARTS 12
DELHI Head Office 20

(a) Suggest the most appropriate location of the server inside the HYDERABAD campus (out of the 4 buildings), to get the best connectivity for maximum no. of computers. Justify your answer.

(b) Suggest and draw the cable layout to efficiently connect various buildings ‘within the HYDERABAD campus for connecting the computers.

(c) Which hardware device will you suggest to be procured by the company to be installed to protect and control the internet uses within the campus?

(d) Which of the following will you suggest to establish the online face-to-face communication between the people in the Admin Office of HYDERABAD campus and DELHI Head Office?

(a) E-mail (b) Text Chat (c) Video Conferencing (d) Cable TV

Write definition of a Method AFIND(CITIES) to display all the city names from a list of CITIES, which are starting with alphabet A.

For example:If the list CITIES contains[“AHMEDABAD”,”CHENNAI”,”NEW DELHI”,”AMRITSAR”,”AGRA”]The following should get displayedAHEMDABADAMRITSARAGRA

WAP using Function to take an list as parameter and print Second largest elemennt.