Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
+1 vote
49.1k views
in Computer by (79.0k points)

Consider the following table 'Furniture'.

Write SQL commands for the statements (i) to (viii) and write output for SQL queries (ix) and (x).

                   Table : Furniture

FCODE NAME PRICE MANUFDATE WCODE
10023 Coffee table 4000 19-DEC-2016 W03
10001 Dining table 20500 12-JAN-2017 W01
10012 Sofa 35000 06-JUN-2016 W02
10024 Chair 2500 07-APR-2017 W03
10090 Cabinet 18000 31-MAR-2015 W02

(i) To display FCODE, NAME and PRICE of items that have Price less than Rs. 5,000.

(ii) To display NAMES and PRICE of those Furniture Items that have 'table' anywhere in their names.

(iii) To display WCode of Furniture Items. There should be no duplicate values.

(iv) To display the NAMES and PRICE increased by 500.00 of all the furniture items. (Price should only be displayed as increased; there should be no increase in the data in the table).

(v) To display FCODE and NAME of each Furniture Item in descending order of FCODE.

(vi) To display the details of all the Furniture Items which have Manufacturing date (MANUFDATE) between 01-JAN-2016 and 15-JUN-2017 (inclusive of both the dates).

(vii) To display the average PRICE of all the Furniture Items, which are made of Wood with WCODE as W02.

(viii) To display WCODE wise, WCODE and the highest price of Furniture Items.

(ix) SELECT SUM (PRICE) FROM Furniture WHERE WCODE = 'W03'; 

(x) SELECT COUNT (DISTINCT PRICE) FROM Furniture;

1 Answer

+1 vote
by (76.3k points)
selected by
 
Best answer

(i) SELECT FCODE, NAME,PRICE FROM Furniture WHERE PRICE <5000;

(ii) SELECT NAME,PRICE FROM Furniture WHERE NAME LIKE ‘%table%’;

(iii) SELECT DISTINCT(WCODE) FROM Furniture;

(iv) SELECT NAME, PRICE+500 FROM Furniture;

(v) SELECT FCODE, NAME FROM Furniture ORDER BY FCODE DESC;

(vi) SELECT * FROM FURNITURE WHERE MANUFDATE BETWEEN ’2016-01-01’ AND ’2017-06-15’;

                   OR

SELECT * FROM FURNITURE WHERE MANUFDATE >= ’2016-01-01’ AND MANUFDATE <= ’2017-06-15’; 

                    OR

SELECT * FROM FURNITURE WHERE MANUFDATE BETWEEN ’01-JAN-2016’ AND ’15-JUN-2017’;

                         OR

SELECT * FROM FURNITURE WHERE MANUFDATE >= ’01-JAN-2016’AND MANUFDATE <=’15-JUN-2017’;

(vii) SELECT AVG(PRICE) FROM Furniture WHERE WCODE = ‘W02’;

(viii) SELECT WCODE, MAX(PRICE) FROM Furniture

GROUP BY WCODE;

(ix) SUM(PRICE)

6500 

(x) COUNT(DISTINCT PRICE)

5

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...