0% found this document useful (0 votes)
125 views

...............

The document contains 6 questions with multiple SQL queries to be answered based on different tables provided. The questions ask to write SQL commands to display, select, count, group, and filter data based on conditions from the tables. Some example queries include displaying faculty details where salary is greater than 12000, increasing course fees by 500 for a specific course, and counting the number of companies in each city.

Uploaded by

Aditya Kaushik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
125 views

...............

The document contains 6 questions with multiple SQL queries to be answered based on different tables provided. The questions ask to write SQL commands to display, select, count, group, and filter data based on conditions from the tables. Some example queries include displaying faculty details where salary is greater than 12000, increasing course fees by 500 for a specific course, and counting the number of companies in each city.

Uploaded by

Aditya Kaushik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

ASSIGNMENT NO: 3

STRUCTURE QUERY LANGUAGE

Q1: Write SQL commands to solve the Queries on the basis of given tables?

a) To display details of those Faculties whose salary is greater than 12000.

b) To display the details of courses whose fees is in the range of 15000 to 50000 (both values
included).

c) To increase the fees of all courses by 500 of “System Design” Course.

d) To display details of those courses which are taught by ‘Sulekha’ in descending order of
courses.

e) Display details of those faculties whose name’s second character is ‘a’?

f) Display first name and last name of those faculties who teaches “Computer Security”.

g) Display details of those faculties whose salary is between 8000 to 11000?

h) Display name of those courses in which fees is less than 10000?

i) Display details of those employees whose get hired in the company after ‘{31-10-2001}’?
j) Select COUNT(DISTINCT F_ID) from COURSES;

k) Select MIN(Salary) from FACULTY,COURSES where COURSES.F_ID = FACULTY.F_ID;

Q2: Write SQL commands to solve the Queries on the basis of given tables?

a) To display those company name which are having price less than 30000

b) To display the name of the companies in reverse alphabetical order.

c) To increase the price by 1000 for those customer whose name starts with ‘S’

d) To add one more column total price with decimal(10,2) to the table customer

e) Display the product name in such a way that product name appears only once.

f) Display customer name, price, qty, company name , city and product name of
those customer whose purchase quantity more than or equal to 10.

g) Display number of companies in each city.

h) SELECT COUNT(*) ,CITY FROM COMPANY GROUP BY CITY;

i) SELECT MIN(PRICE), MAX(PRICE) FROM CUSTOMER WHERE QTY>10 ;

j) SELECT AVG(QTY) FROM CUSTOMER WHERE NAME LIKE “%r%;


k) SELECT PRODUCTNAME,CITY, PRICE FROM COMPANY,CUSTOMER WHERE
COMPANY.CID=CUSTOMER.CID AND PRODUCTNAME=”MOBILE”;

Q3: Write SQL commands to solve the Queries on the basis of given tables?

a) Display details of all male employees who works in It department?


b) Display details of employees whose experience is equal to 10.
c) Display name, Department and salary of all employees where salary=Basic+
Allowance +DA.
d) Display number of employees in each department?
e) Display minimum DA for female employees?
f) Display names of employee who works in electrical department and having
experience more than 8.
g) Display average salary of all employees of IT department where salary=basic +
allowance + DA.
h) Display names of department in such a way that each department appears only
once.
i) Display minimum and maximum experience in each department?
j) Find Output of the following commands:
a. Select name, gender, experience , basic from employee, salary
where(employee.empid=salary.empid);
b. Select name, gender from employee where name like ‘G%’;
c. Select name, gender, experience from employee where( gender=’F’ and
experience >10);
d. Select name, basic+DA+Allowance Salary from employee where(employee .
empid = salary. Empid);

Q4: Write SQL commands to solve the Queries on the basis of given tables?

a) To display TEACHERNAME, PERIODS of all teachers whose periods less than 25.

b) To display TEACHERNAME, CODE and DESIGNATION from tables SCHOOL and ADMIN
whose gender is male.

c) To display number of teachers in each subject wise.

d) To display CODE, TEACHERNAME and SUBJECT of all teachers who have joined the school
after 01/01/1999.

e) Display teacher name and subject of those teachers whose periods are less than 25 but
experience is more than 10.

f) SELECT MAX (EXPERIENCE), SUBJECT FROM SCHOOL GROUP BY SUBJECT;

g) SELECT TEACHERNAME, GENDER FROM SCHOOL, ADMIN WHERE DESIGNATION =


‘COORDINATOR’ AND SCHOOL.CODE=ADMIN.CODE;
h) SELECT DESIGNATION, COUNT (*) FROM ADMIN GROUP BY DESIGNATION HAVING
COUNT (*)>1.

i) Select name, subject, experience from school, admin where(school.code=admin.code and


gender=”MALE”);
Q5: Write SQL commands to solve the Queries on the basis of given tables?
organization
Q6:

Table: worker

You might also like