0% found this document useful (0 votes)
9 views3 pages

10 SQL QuickRevision

The document provides SQL commands and queries for managing student and item tables, including displaying, inserting, updating, and deleting records. It outlines specific queries for tasks such as filtering students by house color, ordering records, and calculating item amounts. Additionally, it explains the use of SQL commands like INSERT, UPDATE, DELETE, and SELECT, along with data types and primary keys.

Uploaded by

hindustaninaruto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

10 SQL QuickRevision

The document provides SQL commands and queries for managing student and item tables, including displaying, inserting, updating, and deleting records. It outlines specific queries for tasks such as filtering students by house color, ordering records, and calculating item amounts. Additionally, it explains the use of SQL commands like INSERT, UPDATE, DELETE, and SELECT, along with data types and primary keys.

Uploaded by

hindustaninaruto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SQL Commands Class 10 IT Code 402

Q1. Write the queries for the following table : Student

a. Display the entire table


Ans. Select * from Student

b. Display the list of students whose house color is blue.


Ans. Select * from Student where House = “Blue”

c. Display the admission number of students whose house color is green.


Ans. Select Admno from Student where House = “Yellow”

d. To view records in ascending order of Admission Number.


Ans. Select * from Student order by Admno Asc;

e. Display the records of Class 10 Students.


Ans. Select * from students where Class = 10;

f. Display the class of ‘Ravi’


Ans. Select Class from Student where Name = ‘Ravi’

g. Insert the given record : 1004, “Aman”, 11, “Blue”


Ans. Insert into Student values( 1004, “Aman”, 11, “Blue”)

Q2. Which command is used for the following task in database?


1. To insert a new record
2. To modify the existing data.
3. To delete a record
4. To display record
Ans.
1. Insert
2. Update
3. Delete
4. Select
Q3. Write the queries for the following table : Item

a. Write a query to insert a new record of following details


15, “Pencil”, 20, 10
Ans. Insert into Item values(15, “Pencil”, 20, 10)

b. Write a query to display detail of items whose quantity is more than 10.
Ans. Select * from Item where Qty > 10

c. Write a query to change the quantity of Item number 13 to 25.


Ans. Update Item
set Qty = 25
where Itemno = 13

d. Display the total amount of each item. The amount must be calculated as the
price multiplied by quantity for each item
Ans. Select Price * Qty from Item.

e. Display the name of item whose price is 10.


Ans. Select Iname from Item where price = 10

f. Display all the records in ascending order of price.


Ans. Select * from Item order by Price asc.

g. Identify the Primary key from table Item.


Ans. Itemno

h. Write the suitable data type of field “Iname”.


Ans. Char or Varchar

i. Write a query to increase the price of all items by Rs2.


Ans. Update Item
set Price = Price + 2;

j. Write a query to decrease the price of all items by Rs 2 whose price is less than
20.
Ans. Update Item
set Price = Price – 2
where Price < 20;

k. . Write a query to delete all the records from the table Item.
Ans. Delete from Item:

l. Write a query to delete all the records of item Pen from the table Item.
Ans. Delete from item
where iname=’Pen’;

Q4. By default, data is arranged in _________ order using ORDER BY clause.


Ans. Ascending Order

Q5. Which clause is used for the following:


a. To display specific record.
b. To display records in a particular order.
Ans.
1. Where Clause
2. Order by Clause

Q6.

You might also like