Question

Write the SQL query questions from (i) to (iv) and write the output of SQL command for questions from (v) to (vii) given below:

Table: EMPLOYEES

EMPID FIRST NAME LAST NAME ADDRESS CITY
010 George Smith 83 First
Street
Howard
105 Mary Jones 842 Vine
Ave.
Losantiville
152 Sam Tones 33 Elm St. Paris
215 Sarah Ackerman 440 U.S. 110 Upton
244 Manila Sengupta 24 Friends
Street
New Delhi
300 Robert Samuel 9 Fifth Cross Washington
335 Henry Williams 12 Moore
Street
Boston
400 Rachel Lee 121 Harrison
St.
New York
441 Peter Thompson 11 Red Road Paris

Table: EMPSALARY

EMPID SALARY BENEFITS DESIGNATION
010 75000 15000 Manager
105 65000 15000 Manager
152 80000 25000 Director
215 75000 12500 Manager
244 50000 12000 Clerk
300 45000 10000 Clerk
355 40000 10000 Clerk
4000 32000 7500 Salesman
441 28000 7500 Salesman

Write the SQL commands for the following :

(i) To show firstname, lastname, address and city of all employees living in paris.

(ii) To display the content of Employees table in ascending order of Firstname.

(iii) To display the firstname,lastname and total salary of all managers from the tables employee and empsalary, where total salary is calculated as salary+benefits.

(iv) To display the maximum salary among managers and clerks from the table Empsalary.

Give the Output of following SQL commands:

(v) Select firstname, salary from employees, empsalary where designation = ‘Salesman ’and Employees.

empid=Empsalary.empid;

(vi) Select count(distinct designation) from empsalary;

(vii) Select designation, sum(salary) from empsalary group by designation having count(*) >2;

Answer

(i) Select FIRSTNAME, LASTNAME, ADDRESS, CITY From EMPLOYEES

Where CITY= ‘Paris ’;

(ii) Select * From EMPLOYEES

Order By FIRSTNAME;

(iii) Select FIRSTNAME, LASTNAME, SALARY + BENEFITS "TOTAL SALARY "From EMPLOYEES, EMPSALARY

Where EMPLOYEES.EMPID=EMPSALARY.

EMPID;

(iv) Select Max(SALARY) From EMPSALARY Where DESIGNATION = 'Manager' OR

DESIGNATION = ‘Clerk ’;

(v) FIRSTNAME SALARY

Rachel 32000

Peter 28000

(vi) COUNT (DISTINCT DESIGNATION)
4
(vii) DESIGNATION SUM(SALARY)

Manager 215000

Clerk 135000

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

Explore more

Similar questions

Write a program to count no. of records in csv file and display the records in tabular form. Admno, Name, Eng, Hindi, Maths, Sci, Ssc 1101 1102 1103 1104 1105 Tejas Swati Sam Imran Heena 80 90 90 75 85 85 85 80 76 90 95 94 64 80 90 94 96 85 80 75 86 80 70
WAP to find the sum of first n terms of the following series:
$1-\frac{x^3}{3 !}+\frac{x^5}{5 !}-\frac{x^7}{7 !} \ldots$
Write a program to implement the stack using list.
Write the function Selection() to sort the list using Selection sort technique. The function will take the list as parameter.
Write the Pseudocode to sort the list using Selection sort – to sort a list A in ascending order
Write a menu driven program using the function that asks the user which type chart, they want to make with given data: Sample data: Programming languages: Java, Python, R, JavaScript, C#, C++ Popularity: 22.2, 17.6, 8.8, 8, 7.7, 6.7

Write a program to create the list and ask user whether you want to delete an element if say yes then delete the element and print the new list else print the entered list.

Trine Tech Corporation (TTC) is a professional consultancy company. The company is planning to set up their new offices in India with its hub at Hyderabad. As a network adviser, you have to understand their requirement and suggest them the best available solutions. Their queries are mentioned (a) to (d) below.

Block to Block distances (in Mtrs.)

FROMToDistance
Human resourceConference110
Human resourceFinance40
ConferenceFinance80

Number of computers in each of the blocks/Center is as follows:

Human resource25
Finance120
Conference90

(a) What will be the most appropriate block, where TTC should plan to install the server?

(b) Draw a block to block cable layout to connect all the buildings in the most appropriate manner for efficient communication.

(c) What will be the best possible connectivity out of the following, you will suggest to connect the new setup of offices in Bangalore with its London based office?

Satellite Link, Infrared, Ethernet cable

(d) Which of the following devices will be suggested by you to connect each computer in each of the buildings.

Switch, modem, Gateway

Write the function Bubble() to sort the list using Bubble sort technique. The function will take the list as parameter.
WAP to find the sum of first n terms of the following series:
$x-x^2+x^3+\ldots$