2+
a) Create the following table items.
Column name
Data
type
Size Constrain
Itemno
Integer Primary key
Iname
Varchar 15
Price
Numeric 10,2
Quantity
Integer 3
a) Consider the following table Item and write the queries (i) and (ii).
Table: Item
Itemno
iname Price Quantity
11
Soap
40 80
22
Powder
80
30
33
Face cream
250
25
44
Shampoo 120 100
55
Soap box 20 50
i. Write a command to insert a new record with the following values:
(66, 'Gel', 150, 70).
ii. Write a query to display all the record of table Item whose price is in the range of
100 and 300.
or
Write a query to display all the records of a table in descending order of
quantity
Answers
Answer:
a) Create the following table items.
Column name
Data
type
Size Constrain
Itemno
Integer Primary key
Iname
Varchar 15
Price
Numeric 10,2
Quantity
Integer 3
a) Consider the following table Item and write the queries (i) and (ii).
Table: Item
Itemno
iname Price Quantity
11
Soap
40 80
22
Powder
80
30
33
Face cream
250
25
44
Shampoo 120 100
55
Soap box 20 50
i. Write a command to insert a new record with the following values:
(66, 'Gel', 150, 70).
ii. Write a query to display all the record of table Item whose price is in the range of
100 and 300.
or
Write a query to display all the records of a table in descending order of
quantity
Answer:
The answer is
1) INSERT INTO ITEM VALUES ( 66 , ' Gel ' , 150 , 70 ) ;
2) SELECT * FROM ITEM WHERE PRICE BETWEEN 100 AND 300;
Explanation:
We need to write queries for the following questions,
1. We need to write a command to insert a new record with the following values:
( 66 , ' Gel ' , 150 , 70 ) .
2. We need to write a query to display all the record of table Item whose price is in the range of
100 and 300.
1) Ans : INSERT INTO ITEM VALUES ( 66 , ' Gel ' , 150 , 70 ) ;
2) Ans : SELECT * FROM ITEM WHERE PRICE BETWEEN 100 AND 300;
What is an SQL query?
https://brainly.in/question/47004
Similar problems
https://brainly.in/question/15442524
#SPJ5