0% found this document useful (0 votes)
4 views2 pages

commands

The document provides SQL commands and queries for creating and manipulating tables, specifically for 'Students' and 'Fabric'. It includes instructions for creating tables, inserting records, updating entries, and querying data based on specific conditions. Additionally, it suggests appropriate data types for fields and includes examples of SQL commands for various operations.

Uploaded by

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

commands

The document provides SQL commands and queries for creating and manipulating tables, specifically for 'Students' and 'Fabric'. It includes instructions for creating tables, inserting records, updating entries, and querying data based on specific conditions. Additionally, it suggests appropriate data types for fields and includes examples of SQL commands for various operations.

Uploaded by

nehagulati0486
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

SQL Commands Notes

(a) Write a SQL query to create the table PT1. [ 2 Marks]


(b) Write a query to insert new value to the table. [1 Mark]
(c) Write a query to update the record of ID=102. [1 Mark]
2. Write command and queries to create and manipulate the records of a table named ‘Students’
with the following fields: (1+1+1+1)
Roll_No Name Class Marks
101 Ajay X 765
107 Suraj IX 865
109 Simran X 766
103 Aman IX 821
104 Naresh IX 1
a. Write SQL command to create the above-given table.
b. Set appropriate data types for the fields. (Roll_No, Name, Class, Marks)
c. Write a query to display the details of all the students studying in class X.
d. Write the query to change the Roll_No of the student named “Aman” to 106.
e. How many records and fields are there in given table.
3.

1. Write the SQL Commands to answer the queries based on Fabric Table.
FabricID FabricName Type Disc
F002 Suits Cotton 20
F003 Kurta Woolen 10
F004 Jeans Denim 15
F005 Shorts Cotton 7
F007 Sarees Silk 11
a. Suggest a suitable data type for the FabricName, Disc fields.
Ans. FabricName-Varchar
Disc-Integer
b. Write SQL commands to create the given table?
Ans. Create table fabric (FabricID char(4),FabricName varchar(20), Type varchar(15), Disc integer);
c. Add a new record with following details:
(“F001”,”jackets”,”Leather”,”6”)
Ans. Insert into Fabric values (‘F001’,’Jackets’,’Leather’,’6’);
d. Write a query to display all the records of table.
Ans. Select * from Fabric;
e. To display only those Fabric Name whose disc is more than 10
Ans. Select Fabric Name from Fabric where disc>10;
f. To Display those records whose type is ‘woolen’.
Ans. Select * from Fabric where type=’woolen’;
g. To modify the disc of fabric jeans from 15 to 18.
Ans. Update Fabric set disc=’18’ where fabricName=’Jeans’;
h. To view records in ascending order of FabricName from the table
Ans. select * from fabric order by “FabricName” ASC;
i.To delete the record of fabric ‘F002’ from the table.
Ans. Delete * from fabric where fabricID=’F002’;
2.

Ans. Create table items( Itemno integer Primary key, Iname varchar(15), Price Numeric(10,2),
Quantity Integer );

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy